Set working directory for OS X
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
#include "SDLApplication.h"
|
||||
|
||||
#ifdef HX_MACOS
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#endif
|
||||
|
||||
|
||||
namespace lime {
|
||||
|
||||
@@ -18,6 +22,18 @@ namespace lime {
|
||||
|
||||
SDL_Init (SDL_INIT_VIDEO | SDL_INIT_TIMER);
|
||||
|
||||
#ifdef HX_MACOS
|
||||
// set working directory for OS X
|
||||
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL (CFBundleGetMainBundle ());
|
||||
char path[PATH_MAX];
|
||||
if (CFURLGetFileSystemRepresentation (resourcesURL, TRUE, (UInt8 *)path, PATH_MAX)) {
|
||||
|
||||
chdir(path);
|
||||
|
||||
}
|
||||
CFRelease(resourcesURL);
|
||||
#endif
|
||||
|
||||
currentUpdate = 0;
|
||||
lastUpdate = 0;
|
||||
nextUpdate = 0;
|
||||
@@ -314,4 +330,4 @@ namespace lime {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user