hi, i cant seem to add my resources (mostly picture files) when i build a universal release to use my program on other machines. how does i do it?
just realised i never found out how to do this� im asking again as id like to release this touch dj software i made for free.
the way i normally do this is to open up the app using âshow package contentsâ, then move the data/ folder into MyApp.app/Resources/data/
then recompile your OF app with this line at the top of setup():
ofSetDataPathRoot("../Resources/data/");
hi there,
was in need for creating a app bundle with data folder included too, thanks for the tips
i added some script lines to the target build phase to automatically copy the data folder into the Resources folder.
here you go (on of007, xcode 4.1):
- click on the blue project icon in the project tree at the left
- click on the app name under TARGETS in white column
- click tap âBuild Phasesâ
- scroll down to the âRun Scriptâ tab
(textbox starts with cp -f âŚ/âŚ/âŚ/libs/fmodex/lib/osx/libfmodex.dylib etc.) - at the end of the script stuff, add the three lines below:
rm -R -f â$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/dataâ; mkdir -p â$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/â; cp -f -R bin/data â$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources/â;
this does:
a) remove the data folder from a possible previous build (make sure removed files in data folder donât stick around in the app bundle on new builds),
b) make sure the Resources folder is existing within the app bundle
c) copy the complete data folder into the Resources folder
- in your testApp.cpp setup() indeed add this line as mentioned in previous post:
ofSetDataPathRoot("âŚ/Resources/data/");
- you can now load your assets as you normally would from the data folder, but now it will be loaded from your app bundle contents/resources folder:
testApp.h
ofSoundPlayer player;
testApp.cpp
player.loadSound(âsounds/beat.wavâ);
-
run your app (debug or release) to make sure it worked out
-
optionally verify that everything is in place by browsing to your app in the finder, hit right click âshow package contentsâ, go down to Contents/Resources/data and recognize your files are there.
-
double check if your app is now working on different places in your machines file system by copying the app bundle to your desktop for instance and doubleclick it: the bundle contains all it needs and should now work independently. ready for distribution!
good luck,
arne.