Save directory

Hey, I'm making a game in java at the moment and I'm making some saving / loading functions. I'm just wondering. Where should i put all the saved settings and game-saveings files?

These two directorys are the ones that I minded up to save the files in, oh and let's say my game's name is "unnamed".

new File(FileSysteView.getFileSystemView().getHomeDirectory(), ".unnamed");

new File (System.getProperty("user.home"), ".unnamed");

Or, where do you think?

[490 byte] By [Lajnus_NineElevena] at [2007-11-26 18:49:34]
# 1
The directory the app is installed to should be fine. If you think about it from an end users point of view they don't really care where it saved to. They just expect to load the game and your code to be able to find the saved data.
kikemellya at 2007-7-9 6:23:35 > top of Java-index,Java Essentials,New To Java...
# 2
Yeah, but I mean if they want to remove it. i dunno how to register stuff in the like "installation-list" yet.because im using my game in a java archive i cant write the files in the same directory as the class files
Lajnus_NineElevena at 2007-7-9 6:23:35 > top of Java-index,Java Essentials,New To Java...
# 3

I propose to create a separate directory "dist" were you create a subdirectory "data" . This subdirectory will contain your game-data.

In dist-directory you store your JAR file myGame.jar . To distribute the game you just have to zip the the dist-directories content to a zip-file and then sent it to the world! The end-user can store/unzip the application were he wants.

In your code you use f.e. this method to fill the file path in io - actions.

System.getProperty ("user.dir") + "\\" + "data" + "\\" + "unnamedFile" .

In a readme.txt file you explain the user that when he wants to get rid of the game he has to delete the JAR file and the data file at the unzip-location.

I'm not a great Java expert but I've solved the problem that way in my code.

DFWeea at 2007-7-9 6:23:35 > top of Java-index,Java Essentials,New To Java...