|Nov 15, 2012, 03:13 PM||#1|
XCode 4.2 and referencing external files
Hello MacRumors! I'm finally taking the dive and trying to learn how to port my C++ game to Mac via XCode. With sfml and opengl, that hasn't been too hard - but I use a custom file type that I read in with ifstream (although I've been told I should switch to fopen eventually) and while I have it working when I click Run in XCode, the OS X App itself does not know how to read in these files. More details below, but, any thoughts?
I am importing this project into XCode essentially, so I took a working SFML framework, added my files, swapped out the main and hit run. Amazingly, all the core stuff worked! The maps (external files in question) did not load though, and it ended up being due to the location of the working directory. Going into XCode's scheme and changing it to be the working dir I use for my old project itself, the maps began loading just fine (since all the map addresses are relative, ie "./maps/world1.map") when I clicked the Run button from inside XCode. Great! But I want to share the file with friends.
Going into the Derived Data path, where ultimately under Derived Data/Project Folder/Build/Products/Debug I found myGame.app, a 75MB Intel App (so it appears to be sucking up all the music and sound effect files, since the example sfml project before would only make an 8MB app). Trying to run this file by double clicking though makes the project open, but no sound, music, maps, or images load (so none of the external files that were referenced in the working directory). Moving the app into the working directory does not fix this problem either.
So far I have been unable to find a way to build the app directly into the working directory, and am only able to influence its placement by changing Derived Data in Preferences for all of XCode. So, any tips on how to get my final product seeing files the same way that the one run out of XCode sees?
EDIT: And I was wrong! The game does not work flawlessly from XCode, only the first level (the one loaded when building the game) loads properly, every level after that fails to load. I'm guessing that's since after that point, the game is running from the dir where it was built to rather than the one it was built from.
Last edited by BlinksTale; Nov 15, 2012 at 03:28 PM.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Xcode gets the wrong path when adding files||printz||Mac Programming||1||Mar 6, 2014 04:01 AM|
|Where are files downloaded by Xcode being stored?||MacMan988||OS X 10.8 Mountain Lion||1||Jan 26, 2013 09:35 AM|
|How to ignore project files with xcode git ?||mikezang||iPhone/iPad Programming||1||Jan 7, 2013 04:14 AM|
|Input/Output with files in XCode||crisro996||Mac Programming||2||Jul 21, 2012 12:20 PM|
|Referencing Controls within / from sub views||CylonGlitch||Mac Programming||14||Jun 25, 2012 08:06 PM|
All times are GMT -5. The time now is 07:05 AM.