I have a MAC cocoa application which is getting the Current working Directory using
When i launch the Application from XCode, the current working directory is set to the Proper Path by Juce , but when i launch the Same from Finder, It goes to the Default path /Volumes/Macintosh HD/…
Please guide me how can i resolve this Issue ?
I think perhaps you don’t understand what the CWD is for…?
Maybe you really want the application’s parent folder or something instead? See File::getSpecialLocation()
Sorry, I may be wrong in my Explanation …
Here is my Issue …
When we launch a executable in Windows, File::getCurrentWorkingDirectory().getFullPathName() gets resolved to the path from where that exe is Launched .
But in MAC, if i launch the executable from Finder, File::getCurrentWorkingDirectory().getFullPathName() gets resolved to the default root directory (say /MacintoshHD) … It gets Resolved to a proper directory only when the Application is run via a Debugger (XCode) … Do i need to do any setting in some Info.plist file or some thing to make it resolve to a proper Path ?
Like I said, you’re obviously misunderstanding the meaning of “working directory”. It is NOT the folder that contains your app.
If you want to find out the folder that contains your app, then use File::getSpecialLocation(), like I suggested above.
I have tried ur Suggestion using File::getSpecialLocation() for MAC and it works …
I am Just comparing Windows and MAC here . In Windows, File::getCurrentWorkingDir() is the folder that contains my APP … But in MAC it is not like that …
U mean to Say, for Windows we use File::getCurrentWorkingDir() but for MAC, the same thing doesnt work and we have to use File::getSpecialLocation() …
THE WORKING DIRECTORY HAS NOTHING AT ALL TO DO WITH THE FOLDER THAT YOUR APP LIVES IN!!!
The CWD is irrelevant in a GUI app, it’s really only meaningful in the context of parsing filenames in a command-line app. But it’s a pretty fundamental computing concept and you should understand what it means.