0

It goes well when using QProcess to start a program if its path without space.
eg:

QProcess app;
app.startDetached("open /Users/test/Desktop/MyTest/Hello.app");

But, it doesn't work if the program path containing spaces.
eg:

QProcess app;
app.startDetached("open /Users/test/Desktop/My Test/Hello.app");

Someone can help me and tell me how to start a program with space in its path?
Thanks!

4

1 回答 1

4

您需要在字符串中使用引号作为路径:-

app.startDetached("open \"/Users/test/Desktop/My Test/Hello.app\"");

如果没有引号,空格将建议路径的下一部分作为传递给 open 调用的第二个参数。

于 2013-04-25T12:27:12.227 回答