[warning] ofUtils: ofToDataPath: error while trying to change back to default working directory


tried to run OF project under windows and got this error in command line. But it perfectally worked 3 days ago. What does it mean? how to solve this problem?

Do you use ofSystemSaveDialog() somewhere in your code?

No, I don’t.

Fortunately, my application normally started after reboot. I realy have not idea what happened. I steel got this warning in cmd, but the programm is working correctly.

what happens if you try to load something from data after you had this warning?

I already read this warning. I just investigate a little, and it appear to be related to loading stuffs during the initialisation. An empty project with:

ofImage img;

in the main fonction generate this warning. Perhaps there’s no point to load an image in the main function, but the same thing happens when loading xml configuration files with ofxXmlSettings.

I use a lot of stuff from data in my app, such as pictures, 3D-models, audio files, XML files. Now they load and work correctly .

Thanks for reply. I begin to understand.

a good solution to this is to call in the first line of main


this should then set the data path correctly even before the app has been created.


It works. Thanks @theo :slight_smile:

Hi all,

Sorry for recalling this old thread.

I’m trying to debug an error where images fail to save when the app is launched out of VS (yes Im on windows).
the error is ofDirectory : createdirectory() : couldn't create directory ...

Then I saw I get the datapath warning (post title) as soon as I call ofFilePath().getAbsolutePath().
I found this old thread, but that API is already gone.

To me it seems that since i run oF from inside of Qt some paths might be broken, I guess I should set the path to data folder manually?


Ok here is the way I temporarily fixed it.

			ofSaveImage(sequence[i], "data/"+filepath, exportQuality);

But still, there is something i don’t understand. Why this happens only in ofSaveImage? Why am i getting the warning and how to fix that? I would like to get a fix like the one proposed by Theo.