From cbf1b717914ca9d3e52d7ceaae153928afcc9eda Mon Sep 17 00:00:00 2001 From: Jan200101 Date: Wed, 29 Jun 2022 23:12:33 +0200 Subject: 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/steam.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') 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"; -- cgit v1.2.3