So, I'm creating a game and need to create directories to store all the user's data and saves and whatnot. As you can see, I need to create a folder in the Application Data folder of the user called, "[WarDungeon]", and there, I will store other folders for such data like levels, the bin, sprites, etc.
I am not too interested in working with Mac OS and Linux as I want to get the %appdata% folder working with Windows to begin with.
Here's my code:
public FileManage() {
gamePath = System.getenv("APPDATA") + "[WarDungeon]";
gameLevelPath = System.getProperty("user.home") + "\\Local Settings\\ApplicationData\\[WarDungeon]\\level";
gameBinPath = System.getProperty("user.home") + "\\Local Settings\\ApplicationData\\[WarDungeon]\\bin";
File createDir1 = new File(gamePath);
createDir1.mkdir();
System.out.println("First test passed.");
if (createDir1.exists() == true) {
System.out.println("First directory created!");
}
}
How do I fix this?
Thanks in advance, :)