diff options
author | B. Stack <bgstack15@gmail.com> | 2022-11-22 08:54:34 -0500 |
---|---|---|
committer | B. Stack <bgstack15@gmail.com> | 2022-11-22 08:54:34 -0500 |
commit | a034cfca98d4408b175938740628a54f57eb7614 (patch) | |
tree | 501fd78c6276c0be8be8d2c671a58dd0598060b5 /zen/process_exec.cpp | |
parent | add upstream 11.27 (diff) | |
download | FreeFileSync-11.28.tar.gz FreeFileSync-11.28.tar.bz2 FreeFileSync-11.28.zip |
add upstream 11.2811.28
Diffstat (limited to 'zen/process_exec.cpp')
-rw-r--r-- | zen/process_exec.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/zen/process_exec.cpp b/zen/process_exec.cpp index a2c02eb0..ffc90b4f 100644 --- a/zen/process_exec.cpp +++ b/zen/process_exec.cpp @@ -21,19 +21,20 @@ Zstring zen::escapeCommandArg(const Zstring& arg) { //*INDENT-OFF* if not put exactly here, Astyle will seriously mess this .cpp file up! Zstring output; - for (const Zchar c : arg) + for (const char c : arg) switch (c) { + //case ' ': output += "\\ "; break; -> maybe nicer to use quotes instead? case '"': output += "\\\""; break; //Windows: not needed; " cannot be used as file name case '\\': output += "\\\\"; break; //Windows: path separator! => don't escape case '`': output += "\\`"; break; //yes, used in some paths => Windows: no escaping required default: output += c; break; } -//*INDENT-ON* - if (contains(output, Zstr(' '))) - output = Zstr('"') + output + Zstr('"'); //Windows: escaping a single blank instead would not work + if (contains(arg, ' ')) + output = '"' + output + '"'; //caveat: single-quotes not working on macOS if string contains escaped chars! no such issue on Linux return output; +//*INDENT-ON* } |