Where to best store app data on Windows

Oct 5, 2013 at 4:23am

Where to best store app data on Windows

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?

#267095
Oct 5, 2013 at 8:23am

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 );

#267110
Oct 5, 2013 at 11:35am

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

#267131
Oct 9, 2013 at 1:35pm

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

#267618

You must be logged in to reply to this topic.