I’m compiling an app for OSX and Windows. On OSX it is easy to move the ‘data’ folder from OF into the actual app itself using the following commands:
ofEnableDataPath();
ofSetDataPathRoot();
However, on Windows I would need to have the ‘data’ folder in the user’s AppData folder location. Typically the %APPDATA% is used in e.g. installers, but it doesn’t seem that OF is recognizing the environment variable in the strings. Is there a way to point the data-path-root to the appdata folder by using the environment variable?
I ended up using the getenv() command. Another tricky thing is that Windows uses backslashes in the locations, which you cannot add intro the string… so I need to add another char and replace it with the hexcode for backslash but it works
#ifdef TARGET_WIN32
string newRoot = ofToString( getenv(“PUBLIC”)) + ofToString("=Documents=Sxratch");
ofStringReplace(newRoot, “=”, “\x5C”); // need to put in the backslash
ofEnableDataPath();
ofSetDataPathRoot(newRoot); #endif