Using environment variable in data-path

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?

not super familiar with window env variables but could you use something like this to read 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 :confused: 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