Relative paths not working from .app file


I’m using XCode 3.2.6 and when I execute a compiled application (e.g. or the files stored in ‘data’ folder are not loaded. Details are given below.

All my files are stored in ‘(Some_Folder)/of_v0.7.4_osx_release/apps/myApps/myExample/bin/data/’ and when I access to them I use the following relative path:

  1. “./data/file.txt” when I use ifstream (e.g. to load some parameters);
  2. “videofile.avi” when I use loadMovie from ofVideoPlayer class.

When I click on ‘Build and Run’ everything works fine, the files are loaded. However, when I get into the folder of the compiled application and I double click either on myExample or myExampleDebug the software runs but nothing is loaded.

My goal is to generate a standalone application (.app) that I can distribute. So I can tell to people to place the files into the folder “./data/” that has to be in the same folder of

Do you have any idea of how I can sort this problem out?


can you check the preferences on the app – like this:

sometimes the “use current working directory” is set which can alter were the app’s home directory is set to. If it’s clikced, unclick it and see if that helps?

zack is as always right on the money, but on a related note…
you know… if your app is running on Macintosh you can use the
to make it a stand alone app so that you don’t have to make your users deal with a data folder…

if **you are already using it ** in your code you need to open your compiled .app with the “show package content” and paste what is inside your DATA folder somewhare in there - probably in the folder named “MacOS”…

… just paste the files not the entire folder… but do paste any subfolders if you have any…


I was just about to ask about this issue, I’ll give it a try thanks a lot