My Documents\My Games folder

I’ve been storing save files for my Java games in the My Documents folder for the current user (which is what you’re supposed to do on Windows XP and presumably on Windows Vista). I’ve noticed that my My Documents folder contains a folder “My Games”, which contains another folder for Heroes of Might and Magic V.

Is this My Games folder included in the My Documents folder on every Windows XP/Vista computer? Or is it just a folder HoMM V put there?

I only ask because it seems like it would be a good standard folder to store saved games in. I plan to store mine in My Documents\My Games[my company name][my game name] from now on.

“My Documents” is NOT a real directory anymore on Windows Vista! I believe it’s now called “Documents”? Although they appear to be linked: “My Documents” links to “Documents”!?

good question ;D

It’s “Documents and Settings” in both XP and Vista. If I recall correctly you’re only allowed to write to the users homedirectory in Vista, which would be fx “Documents and Settings\Username[Your dir here]”. You can query for the current users homedir with System.getProperty(“user.home”)

Ah, I see.

I was using the right Documents and Settings directory before, though I was getting it from the initial value of some FileSystemView method. I will now use System.getProperty(“user.home”) instead. I imagine that FileSystemView’s default directory just happens to be initialized to that value.

In any case, I’m glad to know that the My Games directory isn’t a standard directory. I might create the directory for my game anyways just because I think it would help keep everything organized if everyone used it.

I’ve discovered the “Application Data” folder at “C:\Documents and Settings[user name]\Application Data”. I’m now going to use the folder “C:\Documents and Settings[user name]\Application Data[my company name][my game name]” to store my application data. It’s too bad that I used the “My Documents” folder for previous games, but the players will just have to deal with it. :slight_smile:

I only noticed the folder by mistake, but now I know about it. If I ever saw it before (I probably did), I don’t remember.

Please note that the Application Data directory is inappropriate for things like save games (or any other data the user “creates” or “manages” himself). As you have found out, the Application Data directory isn’t exactly obvious, so user created data should not be stored there because the user won’t be able to find it. It is appropriate to store application settings or any other data that can be easily recreated in there, though. Although for some data, using the preferences API might be even more appropriate. This last approach has the advantage of being platform independent too.

Also note that the “Application Data” directory is Microsoft Windows specific. Mac OSX has directory that serves a similar purpose called “Library”. On Linux, the custom is to store application data in the user’s home directory in “hidden” directories (e.g. “.myapp”). Sadly, there is no API for retrieving the “application data” directory in a platform independent manner (yet).

Go to microsoft.com, find the KnowledgeBase, and start searching it.

They have detailed, specific, official guides on exactly what to place where.

Also keep in mind that the directories you are talking about have different pathnames for localized versions of windows. “My Documents” is for example called “Eigene Dateien” in a german Windows. I only know of FileSystemView.getDefaultDirectory() to get this location in a locale independent way.

got the same problem with the default fileSystemView on OS X. some folders store Pictures and Movies and should refer to the correct pathname while in French or German they’re called and displayed by “Images” or “Bilder” or w/ever…
Now I’ve found that the various look-and-feels that re available on the web can solve this issue. For example the Office2003LAF and LiquidLAF seem not to interfer with these specials aliases. ???

I’m not worried about Mac OS X and Linux at this point, though I would like to eventually port some games to them.

As suggested, I looked in Microsoft’s Knowledge Base. According to http://support.microsoft.com/kb/832782/en-us , Microsoft’s own games save in EITHER the My Documents or Application Data folders.

I think the Application Data folder is a little bit more appropriate because saved games shouldn’t be used by other applications. The player usually won’t need to find them since they should be found automatically by the game.

It probably isn’t that important which of the My Documents or Application Data folders people use. If weren’t for the security features in Windows XP (and presumably Vista) that prevent applications from writing to regular folders (like the Program Files folder), I would probably just include the save games in a subdirectory of the application’s directory.

On the other hand, putting them in My Documents means that they’ll probably get backed up automatically without the user having to go hunt them down manually. I’ve been through all this before and annoyingly you’ll get a completely different answer from each person you ask, all with very reasonably justifications.

There was some talk about adding similar functionality to this to LWJGL ( http://lwjgl.org/forum/index.php/topic,2198.0.html ) but I don’t know if thats still planned or if it’s been forgotten.

The other microsoft KB to look for is Windows UAD (IIRC), which is the basis for all of vista’s stuff.

Vista is a LOT more careful about the organizaion of user data - for the first time ever in windows, it’s no longer a complete mess with tonnes of rubbish all piled in the same place, and lots of nonsensical directories everywhere. Not saying it’s perfect, but it’s a lot better IMHO.