XCode, App and Data files
So, I have been building my game on the Mac using XCode, SDL and OpenGL for a while now and I am actually in danger of completing one. It suddenly occurs to me that I don't actually know how to package one up. By that I mean how do I get the final App package to contain the data and get the App to read from it. Up till now I have set the absolute path. Any help/tips on this will be helpful!
Dump your assets folder into your Xcode project. Use "Create Folder References...". Xcode will copy that folder into the Resources directory of the application package (YourGame.app/Contents/Resources/YourAssetsFolder). Then you could reference it relative to the current working directory (or change the directory) which can be done with plain C, or you could use a Cocoa method to get at the Resources folder path and use that, or SDL might have something to get at the Resources path as well (I'm not sure).
I have a copy of XCode 3 unleashed that I have been working through in order to solve this little issue and your one little post cut through all that like a hot knife through butter. Thanks!
I don't trust XCode to include my resources on its own - it tends not to notice when they change. For that reason I use a custom build phase to run rsync to copy my resources into the bundle for me.
Code:
rsync -r [i]ProjectFolder/Resources AppBundlePath/Contents/Resources[/i]
Are you using any .dylibs? If so, there may be some special requirements.
Worlds at War (Current Project) - http://www.awkward-games.com/forum/
I am using one dylib and have setup the DYLD_LIBRARY_PATH variable to point at the library concerned. Took a bit of digging to find that one too.