Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sound->LoadMusic( (std::string) "Resources/Audio/Pop.wav" );
- std::cout << "Current directory is: " << getcwd( buffer, 1000) << "n";
- #ifdef __APPLE__
- #include "CoreFoundation/CoreFoundation.h"
- #endif
- // ----------------------------------------------------------------------------
- // This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle
- #ifdef __APPLE__
- CFBundleRef mainBundle = CFBundleGetMainBundle();
- CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
- char path[PATH_MAX];
- if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
- {
- // error!
- }
- CFRelease(resourcesURL);
- chdir(path);
- std::cout << "Current Path: " << path << std::endl;
- #endif
- // ----------------------------------------------------------------------------
Add Comment
Please, Sign In to add comment