Pass absolute path to exe in argv[0] (#31)

This commit is contained in:
Luke Street 2023-01-23 10:35:50 -05:00 committed by GitHub
parent 67f99ba1b2
commit 9837ce0bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -177,8 +177,13 @@ int main(int argc, char **argv) {
// Build a command line
std::string cmdLine;
for (int i = 1; i < argc; i++) {
if (i != 1) cmdLine += ' ';
std::string arg = argv[i];
std::string arg;
if (i == 1) {
arg = files::pathToWindows(std::filesystem::absolute(argv[1]));
} else {
cmdLine += ' ';
arg = argv[i];
}
bool needQuotes = arg.find_first_of("\\\" \t\n") != std::string::npos;
if (needQuotes)
cmdLine += '"';