Solved Start MaintenanceTool.app from my application under macOS
-
Under macOS, I would like to start MaintenanceTool.app from my application.
MaintenanceTool is in the same directory as my application.
I use startDetached in this way:
QProcess::startDetached("~/" + QStandardPaths::displayName(QStandardPaths::ApplicationsLocation) + "/myappl/MaintenanceTool.app/Contents/MacOS/MaintenanceTool");
The response is true but MaintenanceTool does not start.
How to do this?
-
Thank you J.Hilk, it works perfectly!
-
hi
@Francky033 said in Start MaintenanceTool.app from my application under macOS:
("~/" + QStandardPaths::displayName(QStandardPaths::ApplicationsLocation)are you sure this returns the correct path?
I usually get the path via QApplication::applicationDirPath(), modify the string and start the process that way,
something along this line:
QString path = QApplication::applicationDirPath(); if(path.contains("myApp.app/Contents/MacOS")) path = path.remove("myApp.app/Contents/MacOS"); path = path + "maintenancetool.app/Contents/MacOS/maintenancetool"; process->start(path,args);
But I'm by no means a Mac expert, and this was quite literally the first thing I tried, backing than, and I've been running with an - don't fix it if it's not broken - approach ever since ;-)
-
@Francky033 said in Start MaintenanceTool.app from my application under macOS:
QStandardPaths::displayName(QStandardPaths::ApplicationsLocation)
Doesn't this return an absolute path?
-
Thank you J.Hilk, it works perfectly!