How do I set an OS X application bundle's working directory?
Question
Is there a key I can set in my application bundle to set what the working directory will be for the executable? It needs to be the $BUNDLE
/Contents/MacOS directory (because of some library dependencies that do runtime loading that I can't easily modify).
I'm aware this can be done by wrapping with a script instead but I'd rather not.
Solution
No, there is not. However, you can just add an appropriate chdir() in your main() function before calling NSApplicationMain.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow