It was a working directory problem. using getcwd
while executing "myApp.app" gives /
I fixed it by using the bundle dir instead of getcwd
:
#include <CoreFoundation/CoreFoundation.h>
std::string getBundleDir()
{
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
char path[PATH_MAX];
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
return "";
CFRelease(resourcesURL);
chdir(path);
return path;
}