compiling a release build with resources

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/");  
  

1 Like

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):

  1. click on the blue project icon in the project tree at the left
  2. click on the app name under TARGETS in white column
  3. click tap ‘Build Phases’
  4. scroll down to the ‘Run Script’ tab
    (textbox starts with cp -f …/…/…/libs/fmodex/lib/osx/libfmodex.dylib etc.)
  5. 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

  1. in your testApp.cpp setup() indeed add this line as mentioned in previous post:

ofSetDataPathRoot("…/Resources/data/");

  1. 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”);

  1. run your app (debug or release) to make sure it worked out

  2. 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.

  3. 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.

3 Likes