From c43fc735c39e4a77b4a834b6c6a93a191070cf39 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Sat, 3 Jul 2021 12:50:45 +0200 Subject: [PATCH] fix refactoring on linux --- gameheaders/stratagus-game-launcher.h | 8 ++++---- gameheaders/stratagus-gameutils.h | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/gameheaders/stratagus-game-launcher.h b/gameheaders/stratagus-game-launcher.h index a06e24fa1..61e6e36a0 100644 --- a/gameheaders/stratagus-game-launcher.h +++ b/gameheaders/stratagus-game-launcher.h @@ -327,7 +327,7 @@ static void ExtractData(char* extractor_tool, char *const extractor_args[], char std::vector argv = {L"-i", std::filesystem::path(datafile).wstring()}; #else const char *file = "innoextract"; - char *const argv[] = {"-i", datafile.c_str(), NULL}; + char *argv[] = {"-i", (char*)datafile.c_str(), NULL}; #endif if (runCommand(file, argv) == 0) { // innoextract exists and this exe file is an innosetup file @@ -503,7 +503,7 @@ static void ExtractData(char* extractor_tool, char *const extractor_args[], char break; } else { strcat(cmdbuf, " "); - strcat(earg); + strcat(cmdbuf, earg); } } strcat(cmdbuf, " " QUOTE); @@ -645,8 +645,6 @@ int main(int argc, char * argv[]) { sprintf(stratagus_bin, "%s\\stratagus.exe", stratagus_path); } - char *const extractor_args[] = EXTRACTOR_ARGS; - #ifdef DATA_PATH // usually this isn't defined for windows builds. if it is, use it strcpy(data_path, DATA_PATH); @@ -657,6 +655,8 @@ int main(int argc, char * argv[]) { strcpy(stratagus_bin, STRATAGUS_BIN); #endif + char *const extractor_args[] = EXTRACTOR_ARGS; + if (argc > 1) { if (!strcmp(argv[1], "--extract")) { // Force extraction and exit diff --git a/gameheaders/stratagus-gameutils.h b/gameheaders/stratagus-gameutils.h index a8937e12f..e4f65e9c4 100644 --- a/gameheaders/stratagus-gameutils.h +++ b/gameheaders/stratagus-gameutils.h @@ -271,7 +271,7 @@ int runCommand(std::wstring& file, std::vector argv, bool echo = f #include #include -int runCommand(const char *file, char *const argv[], bool echo = false, std::string *outputCommandline = NULL) {) { +int runCommand(const char *file, char *const argv[], bool echo = false, std::string *outputCommandline = NULL) { pid_t pid = fork(); if (echo || outputCommandline) { @@ -280,9 +280,9 @@ int runCommand(const char *file, char *const argv[], bool echo = false, std::str if (argv[i] == NULL) { break; } + commandline += " "; + commandline += argv[i]; } - commandline += " "; - commandline += argv[i]; if (echo) { std::cout << commandline << std::endl; }