loading files from system.ResourceDirectory I GIVE UP

I made a simple Level editor for my game so I can design my levels and save them as a .txt file…Now I want to load each level inside Corona Simulator.  The text file  would have to be part of the apk. in the system.ResourceDirectory… Files inside the Documents sandbox will not be loaded inside Android application package… right?

 …ugh…

 I spent half a day trying everything to load the files into the Corona simulator from system.ResourceDirectory. I think I tried everything – I used JSON & GGFile.  Is it true corona SDK won’t allow you to access any files outside of sandbox But on the device you can???

I guess this is more of a statement – I’M just going to HARD CODE each level.

You should be able to load text files from the system.ResourceDirectory.  You can’t write to it, but during your development, you could write the levels to your sandbox (system.DocumentsDirectory) then copy the files into your folder with your main.lua once you’re happy with them and then load the files from there.

Rob

In my head it seemed like a pain to do it that way… but you make it seem easier then I thought. I’ll give in a try. Thanks Rob

2nd Rob’s input.  I use that exact technique:

  • Game ships with levels stored in Resource Directory.
  • First run, copies level data to Documents Directory.
  • New Levels (if you included editor) and mods to existing levels are done in Documents directory.

Side benefit:

  • Easy to restore to ‘starting state’ by deleting documents directory copies and copying from Resource Directory.

You should be able to load text files from the system.ResourceDirectory.  You can’t write to it, but during your development, you could write the levels to your sandbox (system.DocumentsDirectory) then copy the files into your folder with your main.lua once you’re happy with them and then load the files from there.

Rob

In my head it seemed like a pain to do it that way… but you make it seem easier then I thought. I’ll give in a try. Thanks Rob

2nd Rob’s input.  I use that exact technique:

  • Game ships with levels stored in Resource Directory.
  • First run, copies level data to Documents Directory.
  • New Levels (if you included editor) and mods to existing levels are done in Documents directory.

Side benefit:

  • Easy to restore to ‘starting state’ by deleting documents directory copies and copying from Resource Directory.