0

I'm creating a video-game and I would like to let the player create his own level (stored as .txt file).

I read that the most common solution was to put them in the user home directory using System.getProperty("user.home").

The problem is that the player may create a lot of levels (and thus a lot of files) and that I will soon be disordered.

Is there a way to create a folder with my game and to store those files into it? If so, how can I access them for read and write?

Pshemo
  • 122,468
  • 25
  • 185
  • 269
Lasbleis
  • 21
  • 7
  • 1
    See http://stackoverflow.com/questions/3634853/how-to-create-a-directory-in-java: create a directory under user.home and put all your files in there. – JP Moresmau Jul 20 '15 at 16:56

1 Answers1

1

Sure, you can use something like this

File targetFolder = new File("targetPath"); targetFolder.mkdir();

Code above will create new folder, so you can store files in this folder.