Forums > MaxMSP

Where to best store app data on Windows

October 5, 2013 | 4:23 am

For a standalone app I need to store some external data, so it’s not overwritten when the app is updated or replaced with a new version.

On OSX this is straightforward. I just write stuff to ~/Library/Application Support/Myapp. I am pretty safe to assume that I have permissions to create that directory and write things in it.

On Windows I’m not sure about this. I haven’t used the platform for ages but afaik there is "Program Files" but also possibly "Program Files x86_64" or something. And it is typically located on C:/ but it could be any other drive.

What would be a sensible approach? Are there any helper functions in Max or the SDK that can be used figure out a location on any Windows system that won’t get me into trouble?


October 5, 2013 | 8:23 am

I found some standard W32 api. Makes sense to use that straight from my code. I wasn’t thinking clearly :)

TCHAR pf[MAX_PATH];
SHGetSpecialFolderPath(
0,
pf,
CSIDL_PROGRAM_FILES,
FALSE );


October 5, 2013 | 11:35 am

IMHO, on a multi-user machine CSIDL_APPDATA would probably be better.


October 9, 2013 | 1:35 pm

Thanks for the advice Emmanuel. I’ll try that.


Viewing 4 posts - 1 through 4 (of 4 total)