Tuesday 27 April 2010

FYI: Save games and chars in user home (.jclassicrpg subdir)

Smaller news is that save games, screenshots and created characters are going to be saved in your home directory under '.jclassicrpg' sub-directory -- instead of the game's main directory's sub-directories. Packaging the release will be easier for distribution package maintainers (if there are any...I know of one package only tho' - for OpenSuSE -, but later there might be more packagers as the project gets more complete). Other lesser tweaks happened since last post, leaving around 2-3 things on the TODO list before committing and releasing the first Ardor3D version of jcrpg.

5 comments:

qubodup said...

that's good.

pzi said...

sigh...im relieved mr Q :)

Richard Carter said...

Gah, no!! Are you not yet using Windows 7? Applications are supposed to use the AppData directory. Legacy applications that do not properly use the AppData directory tend to be blocked by UAC and thus broken, though they are not made to crash so they might pretend like they are saving things, but not actually do so.

The workarounds in this situation are 1) disable UAC (not a good choice now that UAC is actually useful and no longer annoying), 2) run the app in compatibility mode for WinXP (popping up a UAC dialog every time you run the app, because it needs special permissions to allow for writing to the entire system), or 3) installing the app somewhere other than C:\Program Files. I hate having to store Eclipse separate from every other program on my computer because of its .eclipse folder in my home directory; I'd much rather extract it to C:\Program Files, or even better, they should make a Windows installer. But instead I store it in C:\dev\eclipse, a workaround for its ignorant cross-platform behavior. Just because Linux uses ~/.appname syntax doesn't mean the same should be done on Windows, especially when the majority of your audience is Windows.

In short, PLEASE on Windows machines use the AppData directory properly, like it was meant to be used! Bonus points if you properly use its subdirectories (Local, LocalLow, Roaming) instead of just picking one and shoving your data into it.

pzi said...

Thanks Ricky C, i was wondering if i should look up some info about this. Thanks for pointing out. I will use this for now:

public static final String prefix = System.getProperty("user.home")+(System.getProperty("os.name").contains("Windows")?
"/AppData/Local/jclassicrpg":"/.jclassicrpg");

Richard Carter said...

Sounds great. Sorry about the rant, I just get frustrated every time I think about the fact that Eclipse can't operate from C:\Program Files. I have been wishing for Eclipse to adapt a Windows installer for years.

And actually, to be compatible with Windows XP, you should probably use System.getenv("APPDATA"), or you can just use the WinXP path home\Local Settings\Application Data\jclassicrpg - Windows 7 will automatically redirect it into the AppData\Local folder for backwards compatibility (no UAC problems here). Note that %APPDATA% corresponds to the Roaming folder. Here's a good Stack Overflow question for reference.

This of course brings up the question of whether you should explicitly test the os.name string for specific versions of Windows so that this doesn't break things in Windows before Application Data was implemented, if you want to even support those. If I were you I would just assume everyone is WinXP or better, and I'd probably just use the WinXP path, since I doubt Windows will ever stop being backwards compatible with [well-written] XP applications (at least not for a very long time).

Twitter