[solved] Mavericks File Permission Problem
-
And that's correct, you don't need to run it in sudo mode.
Can you create a minimal example program that shows the problem ?
-
I made a minimal code version of the problem I have.
Compiled with Qt 5.2rc and qtmacdeployed on Mavericks. Source included.
When launched it will attempt to open one file ("Controls.xml"). If success it will open a QMessageBox "Success"
otherwise a QMessageBox with "Fail"On Mavericks:
-running this as sudo or from QtCreator -> success
-running it from finder -> fails.To test it, get it here ( couldn't figure out how to attach this zip here..):
https://drive.google.com/file/d/0B2hpkmDPq1oaRUEyYmdYWEUyV2s/edit?usp=sharing
-
Just tested it (Had to rebuild your sources, OS X told me It could not open the app because it was from an unidentified developer)
The problems come from the fact that you try to open Controls.xml without giving the path to the file so it's relative to the "current path" of the application. In Mavericks, Apple has modified what working directory it gives to the application and e.g. calling it from the console (./My.app/Contents/MacOS/My) or from finder, will not give the same result, thus your file is really not found -
For the sake of testing, you should give the absolute path e.g. "/Users/your_user_name/path_to/Controls.xml"
-
Just tested it and it works fine with “/Users/your_user_name/path_to/Controls.xml”
both from QtCreator and from Finder. So that's great for testing..But I can't use that for deployment. And the ../../../ thing doesn't seem to work..
when I use
"../../../Controls.xml"
as path (relative to the executable) it works, when running from QtCreator but it doesn't work via double click starting from finder.What could be the solution?
-
The working dir is set by the parent process. You'll get different result if you launch from the Finder or the terminal. This is not a reliable way to find your resources.
Look at QCoreApplication::applicationDirPath or QStandardPaths::locate.