1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-21 01:24:21 +00:00

Better implementation of command-line arg escaping for ChilpProcess on win32

This commit is contained in:
jules 2014-04-08 13:51:44 +01:00
parent 1a75ceb9aa
commit 798de207a7

View file

@ -558,8 +558,16 @@ bool ChildProcess::start (const StringArray& args, int streamFlags)
String escaped;
for (int i = 0; i < args.size(); ++i)
escaped << args[i].replace ("\"", "\\\"")
.replace (" ", "\\ ") << ' ';
{
String arg (args[i]);
// If there are spaces, surround it with quotes. If there are quotes,
// replace them with \" so that CommandLineToArgv will correctly parse them.
if (arg.containsAnyOf ("\" "))
arg = arg.replace ("\"", "\\\"").quoted();
escaped << arg << ' ';
}
return start (escaped.trim(), streamFlags);
}