App doesn't see data folder when run from Visual Studio

Hi all,

I’ve got an oF project in Visual C++ 2008 Express that’s giving me problems. I am using the ofxXmlSettings addon to read an XML file from the data folder.

if (!appSettings.loadFile("app-settings.xml")) {  
    cout << "Could not load app-settings.xml" << endl;  

When I run the app from VC++, I get the error message and my XML file is not being read. However, if I just double-click the EXE in the bin folder, it reads the XML file no problem.

I tried running the ofxXmlSettings example and I don’t have that problem with that project. Any idea what’s going on?


here’s info from the readme file with OF / VS 2008 that I think might help:

run examples from within visual studio

(ie debug, or start without debugging)

for projects that load in external data (movies, fonts, etc) make sure that the following is set:

openFrameworkApp properties > configuration properties > debugging

the value for working directory should be: $(ConfigurationName)

this is because visual studio, when it loads the exe, will by default run the exe from the project directory,
instead of the directory where the exe is compiled to.

We’ve tried to include a “dummy” .user file, (projectName.vcproj.user) so that this setting is kept as
you open the project, but be sure that it is set if you have trouble loading fonts/images/movies. When you
launch the project for the first time, a real “.user” file is made which duplicates the dummy file, and that should
keep the setting from the dummy file.

if you have issues with this, be sure to check the “working directory” for the configuration

I think you might need to check the working directory to make sure it’s set to the bin folder.

hope that helps!

Thanks Zach! I tried that but it didn’t work as it was looking for the app in the “Release” directory. However, I went and looked at one of the example projects and saw that the value for “Working Directory” should actually be “bin”. And that did the trick.

oh sorry – I think maybe the readme is out of date (or wrong?)… I’ll check on it. but yes, working directory should be set to .bin. That’s the nature of using the dummy .user file, it helps set that. (poke in the .user file to see what I mean). Once you open the project, it makes a new user, but keeps the settings from the dummy user file. it may be that step got skipped / messed up if you duplicated a project.

take care,