Images go missing when I move the app bundle

#1

Hello,

My project uses some png images I’ve added to the bin/data folder. When testing builds of the the application from within the authoring directory, the images load as expected (eg: allSequencesImage.loadImage(“testoverview.png”);).

But if I copy the built app bundle to another location and run it, the images are missing.

Here’s how the folder hierarchy looks in my project:

What i expected was to be able to move the openFrameworks.app bundle anywhere, and the images would load as expected, since I do see the images inside the bundle’s resources folder:

Maybe I’ve made some incorrect assumptions somewhere along the way. Can anyone give me a clue about what I’m doing wrong here?

#2

this is because OF is set to look for its files in the data folder relative to the .app executable.

This is so the mac, windows and linux apps can all have their files in the same place relative to the executable.

To do this on a mac we have a ofToDataPath which we use internally which modifies the path prepending " …/…/…/data " to it.

This is because the real executable is in openFrameworks.app/Contents/MacOS/

If you want to load files in OF from the app bundle itself try:

ofSetDataPathRoot("./");

This should then make the app look inside the Resources folder when loading files.

Theo

Probably very simple image problem
Exporting a standalone executable from xCode?
#3

Thanks for the clarification. Setting ofSetDataPathRoot("./") got it working as I hoped.