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():
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/”;
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:
- 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:
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!