Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Get app dir of application on Mac OS sierra
I have trouble with the QApplication::applicationDirPath() and QDir::currentPath() functions.
On some computers this function return strange path:
The correct path is
Why Qt can't find where is the application ?
I found this http://doc.qt.io/qt-5/osx-issues.html#macos-native-api-access but on this page "QCoreApplication::applicationDirPath() can be used to determine the path of the binary within the bundle."
Chris Hennes last edited by
This is part of a change to the way Gatekeeper works on Sierra - apps that aren't signed are moved to a randomized location before execution. So the path returned really is where your executable is, at the moment it is running. It's called "App Translocation."
@Chris-Hennes Ok thanks for this information!
But is there a solution to get some files where is really my application ...whitout QApplication::applicationDirPath() ? :(
Rondog last edited by
Based on what I have read the 'Translocation' (lol) is only done if you are running an app from an archive like a DMG file. The purpose of this is to prevent a signed app from loading unsigned executables that are distributed along with the app. The relative path option would not be usable to give you the true location of the app which prevents this kind of attack.
So, it is doubtful you will be able to find a work around to this.
I expect that the relative path still works within the app container (folder). If you need to include some data or other files with your app why not put them inside the app (not alongside)?
@Rondog ...If you need to include some data or other files with your app why not put them inside the app (not alongside)?...
you mean put the files into in the app bundle ?