My program doesn't create directories on Windows 8, but on Windows 7

My game runs and is saved perfectly on Windows 7, even if the folder I am saving does not exist. I used the following code (roughly):

new File("Data/Saves").mkdirs();

      

The problem arose when I sent it to my friend with Windows 8. He said that the data folder was not found anywhere and it wasn’t saving anything. Obviously a huge problem. Is there a compatibility issue or workaround? Is it even an OS?

+3


source to share


1 answer


Try your path using the line given in new File(".").getCanonicalPath();

At least I think it worked for me, but I don't have access to any Win8 system ...



0


source







All Articles