new File(...)
doesn't crete a file on disk, it only creates a path for a Java program to use to refer to a file that may or may not exist on disk (hence the File.exists()
method).
Try userFile.createNewFile();
to actually create the file on disk.
To make the directory you would need to use the File.mkdirs()
method, but don't call it on userFile
or it will make a directory with the Savegame.txt
in it.
Edit:
File dir = new File(Config.userpath + "/test/");
File file = new File(dir, "," + Config.name + " Savegame.txt");
dir.mkdir(); // should check to see if it succeeds (if(dir.mkdir())...)
file.createNewFile(); // should also check that this succeeds.