aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2022-06-29 23:12:33 +0200
committerJan200101 <sentrycraft123@gmail.com>2022-06-29 23:12:33 +0200
commitcbf1b717914ca9d3e52d7ceaae153928afcc9eda (patch)
tree4b5eb43fae51960c0627a1abb0cfb6ccbe7739a1 /src
parentccd667be067a5148545d7ccc958e29e65a2ac458 (diff)
downloadOFQT-cbf1b717914ca9d3e52d7ceaae153928afcc9eda.tar.gz
OFQT-cbf1b717914ca9d3e52d7ceaae153928afcc9eda.zip
Quote of_dir on Windows
the exec family of functions end up recombining the arguments and invoking them as a whole which causes args with spaces to be seen as muĺtiple args. This way the path is kept as one and correctly passed to -game
Diffstat (limited to 'src')
-rw-r--r--src/steam.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/steam.c b/src/steam.c
index 83d05ce..85c9511 100644
--- a/src/steam.c
+++ b/src/steam.c
@@ -261,11 +261,14 @@ int runOpenFortress(char** args, size_t arg_count)
char** argv = malloc(sizeof(char*) * (arg_count + 6));
+#ifdef _WIN32
size_t of_dir_len = strlen(of_dir);
of_dir = realloc(of_dir, of_dir_len + 3);
memmove(of_dir+1, of_dir, of_dir_len);
of_dir[0] = '"';
of_dir[of_dir_len+1] = '"';
+ of_dir[of_dir_len+2] = '\0';
+#endif
argv[0] = game;
argv[1] = "-game";
@@ -300,6 +303,15 @@ int runOpenFortress(char** args, size_t arg_count)
char** argv = malloc(sizeof(char*) * (arg_count + 8));
+#ifdef _WIN32
+ size_t of_dir_len = strlen(of_dir);
+ of_dir = realloc(of_dir, of_dir_len + 3);
+ memmove(of_dir+1, of_dir, of_dir_len);
+ of_dir[0] = '"';
+ of_dir[of_dir_len+1] = '"';
+ of_dir[of_dir_len+2] = '\0';
+#endif
+
argv[0] = steam;
argv[1] = "-applaunch";
argv[2] = "243750";