summaryrefslogtreecommitdiff
path: root/zen/process_exec.cpp
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-11-22 08:54:34 -0500
committerB. Stack <bgstack15@gmail.com>2022-11-22 08:54:34 -0500
commita034cfca98d4408b175938740628a54f57eb7614 (patch)
tree501fd78c6276c0be8be8d2c671a58dd0598060b5 /zen/process_exec.cpp
parentadd upstream 11.27 (diff)
downloadFreeFileSync-a034cfca98d4408b175938740628a54f57eb7614.tar.gz
FreeFileSync-a034cfca98d4408b175938740628a54f57eb7614.tar.bz2
FreeFileSync-a034cfca98d4408b175938740628a54f57eb7614.zip
add upstream 11.2811.28
Diffstat (limited to 'zen/process_exec.cpp')
-rw-r--r--zen/process_exec.cpp9
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*
}
bgstack15