fix refactoring on linux

This commit is contained in:
Tim Felgentreff 2021-07-03 12:50:45 +02:00
parent 93c149c577
commit c43fc735c3
2 changed files with 7 additions and 7 deletions

View file

@ -327,7 +327,7 @@ static void ExtractData(char* extractor_tool, char *const extractor_args[], char
std::vector<std::wstring> 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

View file

@ -271,7 +271,7 @@ int runCommand(std::wstring& file, std::vector<std::wstring> argv, bool echo = f
#include <unistd.h>
#include <sys/wait.h>
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;
}