I compile using eclipse and c++11 under both Windows and OSX. When I create a release and drag it to another folder, the Windows binary has the current current working directory. The OSX release thinks it's in my home folder. No matter where I place it, it thinks it is running in my home directory.
I put a print statement in my code to prove it: Current working dir: /Users/Dom
This problem only occurs if I double click the binary. If I open a terminal and run the program using ./ it opens in the proper directory.
I'm not sure how to fix this, but it needs to be fixed in order for the application to find relative path specific resources.
Thanks!
SOLUTION:
char path[1024];
uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == 0){ /*...*/ }