Fixed up some stuff in the Apple code (or at least I think I did)
This commit is contained in:
parent
c0ca361da6
commit
ec2d532435
|
@ -56,25 +56,25 @@ int main(int argc, char **argv)
|
||||||
int cheatCount;
|
int cheatCount;
|
||||||
int section;
|
int section;
|
||||||
|
|
||||||
if (chdir(DATADIR) == -1)
|
|
||||||
printf("Warning: failed to change directory to \"%s\"\n", DATADIR);
|
|
||||||
|
|
||||||
// This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
// This makes relative paths work in Xcode by changing directory to the Resources folder inside the .app bundle
|
||||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||||
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
|
if (CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
|
||||||
{
|
{
|
||||||
// error!
|
|
||||||
}
|
|
||||||
CFRelease(resourcesURL);
|
|
||||||
|
|
||||||
chdir(path);
|
chdir(path);
|
||||||
printf("Current directory \"%s\"\n", path);
|
printf("Current directory \"%s\"\n", path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (chdir(DATADIR) == -1)
|
||||||
|
printf("Warning: failed to change directory to \"%s\"\n", DATADIR);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if (chdir(DATADIR) == -1)
|
||||||
|
printf("Warning: failed to change directory to \"%s\"\n", DATADIR);
|
||||||
#endif
|
#endif
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
engine_init(); // Must do this first!
|
engine_init(); // Must do this first!
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue