Browse Source

Made ChildProcess::start() auto-remove quotes from the name of the executable that it is given

tags/2021-05-28
jules 9 years ago
parent
commit
b010df5bcd
1 changed files with 5 additions and 4 deletions
  1. +5
    -4
      modules/juce_core/native/juce_posix_SharedCode.h

+ 5
- 4
modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -1042,10 +1042,11 @@ public:
ActiveProcess (const StringArray& arguments, int streamFlags) ActiveProcess (const StringArray& arguments, int streamFlags)
: childPID (0), pipeHandle (0), readHandle (0) : childPID (0), pipeHandle (0), readHandle (0)
{ {
String exe (arguments[0].unquoted());
// Looks like you're trying to launch a non-existent exe or a folder (perhaps on OSX // Looks like you're trying to launch a non-existent exe or a folder (perhaps on OSX
// you're trying to launch the .app folder rather than the actual binary inside it?) // you're trying to launch the .app folder rather than the actual binary inside it?)
jassert ((! arguments[0].containsChar ('/'))
|| File::getCurrentWorkingDirectory().getChildFile (arguments[0]).existsAsFile());
jassert (File::getCurrentWorkingDirectory().getChildFile (exe).existsAsFile());
int pipeHandles[2] = { 0 }; int pipeHandles[2] = { 0 };
@@ -1078,11 +1079,11 @@ public:
Array<char*> argv; Array<char*> argv;
for (int i = 0; i < arguments.size(); ++i) for (int i = 0; i < arguments.size(); ++i)
if (arguments[i].isNotEmpty()) if (arguments[i].isNotEmpty())
argv.add (const_cast<char*> (arguments[i].toUTF8().getAddress()));
argv.add (const_cast<char*> (arguments[i].toRawUTF8()));
argv.add (nullptr); argv.add (nullptr);
execvp (argv[0], argv.getRawDataPointer());
execvp (exe.toRawUTF8(), argv.getRawDataPointer());
exit (-1); exit (-1);
} }
else else


Loading…
Cancel
Save