Created
July 28, 2012 16:30
-
-
Save obviousjim/3193922 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle | |
// this way you can include your images in the copy phase of the project and don't have to rely on a data/ folder for distribution | |
#ifdef TARGET_OSX | |
ofDisableDataPath(); | |
CFBundleRef mainBundle = CFBundleGetMainBundle(); | |
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); | |
char path[PATH_MAX]; | |
CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX); | |
CFRelease(resourcesURL); | |
chdir(path); | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment