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:
parent
1a75ceb9aa
commit
798de207a7
1 changed files with 10 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue