This is my first time using Xcode and it is appalling to me how completely non intuitive this IDE is. I heard it was better in the past and I really hope it was.
My problem is that the resources my program loads, a data file and an .ini file, it automatically searches for these file in my Home folder. I want for it to search for these files in the Resource folder of the .app. I am using C++ and all of the examples I have found are for Objective-C.
Any idea on how to fix this?
You are probably assuming that, when your app launches, the current working directory of the process is your app’s bundle. It isn’t. (Nothing to do with Xcode particularly — that’s just how OS X works.)
Typically you would use
NSBundle(Objective-C) orCFBundle(C)to find resources in your app bundle. Since you’re using C++, let’s use the C API.
To find the URL to a file “myFile.ini” in the Resources directory in your app bundle:
Or, to just change the CWD to your app bundle: