diff options
-rw-r--r-- | src/setup/mode.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/setup/mode.c b/src/setup/mode.c index ea90c76f..702db67d 100644 --- a/src/setup/mode.c +++ b/src/setup/mode.c @@ -162,16 +162,18 @@ void InitBindings(void) static void SetExecutable(mission_config_t *config) { + char *extension; + free(executable); #ifdef _WIN32 - executable = malloc(strlen(config->executable) + 5); - sprintf(executable, "%s.exe", config->executable); + extension = ".exe"; #else - executable = malloc(strlen(INSTALL_DIR) + strlen(config->executable) + 2); - sprintf(executable, "%s%c%s", INSTALL_DIR, DIR_SEPARATOR, - config->executable); + extension = ""; #endif + + executable = malloc(strlen(config->executable) + 5); + sprintf(executable, "%s%s", config->executable, extension); } static void SetMission(mission_config_t *config) |