ChildProcess and spaces in path

Hi

I have a problem with ChildProcess and spaces in the file path.

I have a mainApp.exe and a childApp.exe. I want the mainApp to launch the childApp.

The two live in the same folder. I use ChildProcess in mainApp, and give it a path like this:

 

//Get the path of the mainApp

File childAppFile = File::getSpecialLocation(File::currentApplicationFile);

//Get the childApp binary

#if JUCE_MAC

childAppFile = childAppFile.getSiblingFile("childApp.app/Contents/MacOS/childApp");

#elif JUCE_WINDOWS

childApp = childAppFile.getSiblingFile("childApp.exe");

#endif


childProcess..start(childAppFile.getFullPathName() + “ “+Parameters, 1);

 

This works on windows, but on osx it fails if there are spaces in the path.

I hit the assertion:       

jassert ((! arguments[0].containsChar ('/'))

                  || File::getCurrentWorkingDirectory().getChildFile (arguments[0]).existsAsFile());

 

So if there is a space in the path the wrong file path is evaluated and existsAsFile returns false

 

If I add quotes (single or double) it does not work, either.

What am I doing wrong?

 

Try with this version and a quoted path

http://www.juce.com/api/classChildProcess.html#ae1b54ec34a8fa09e679aed90c167cb64

Thank you, overlooked that some how

The above link is dead. I’m having trouble with spaces in an executable name right now. Escaping them doesn’t seem to help. Is there a new location for the help file pointed to?

Here is the new link: https://juce.com/doc/classChildProcess#ae1b54ec34a8fa09e679aed90c167cb64

The above link is dead, but people keep on clicking on it, so it might be useful to have the new one: JUCE: ChildProcess Class Reference