I'm being moronic...I know...but

I have been working on a game and have recently got to the load/save bit. I have copied and pasted the load save.lua into a separate lua file and then call upon that from my ‘main’…and amazingly (for me) it all works pretty well.

However…I can’t seem to find the json files that I expected to see in my resource directory. I am using an apple mac (a relatively recent convert to apple by the way…so maybe there’s something dimwitted I’m doing). It’s quite bizarre! I’ve looked through the folder…nothing. Sorted by date modified etc etc…nothing.

My game is quite clearly saving and loading data, but for the life of me I can’t see any new files being generated in the resource (or Documents Directory).

Saved documents are stored in the project sandbox. In the Corona Simulator you select ‘Show Project Sandbox’ and it will take you to the location.

You might have to click through to a folder which will have your project name and some letters and numbers, then into the documents directory.

Thanks Nick. Is there anyway to make the simulator act more like the target platform (e.g.: iPhone)…in that save files are ‘forced’ to be saved in the resource or docs directory? Just seems like an odd and inconvenient way to do things, particularly if you want to regularly check on the contents of these files.

I don’t believe there’s a way of choosing where Corona puts the Project Sandboxes. It is slightly inconvenient, but I just open it up at the start of a session and leave the finder window open.

Files cannot be saved to the resources directory on the device so allowing this on the simulator could lead to problems I guess.

Actually the simulator’s behavior is really what it should be.  We basically take everything in the folder with main.lua and package that into the app bundle which is READ ONLY.  You cannot write to system.ResourcesDirectory.  There are a couple of reasons why this is a good idea.  Let’s say that system.DocumentsDirectory did resolve to a folder called Documents inside your app’s project folder.  You could then use system.resourcesDirectory and a path like Documents/filename to access it.  This would fail horribly on device because that directory structure isn’t real.  Next you would end up with your testing files being distributed to your users.

Since you should be using the directory constants:  system.ResourcesDirectory, system.DocumentsDirectory, system.CachesDirectory and system.TemporaryDirectory, code wise it doesn’t make sense to worry about where the files are. 

Rob

Saved documents are stored in the project sandbox. In the Corona Simulator you select ‘Show Project Sandbox’ and it will take you to the location.

You might have to click through to a folder which will have your project name and some letters and numbers, then into the documents directory.

Thanks Nick. Is there anyway to make the simulator act more like the target platform (e.g.: iPhone)…in that save files are ‘forced’ to be saved in the resource or docs directory? Just seems like an odd and inconvenient way to do things, particularly if you want to regularly check on the contents of these files.

I don’t believe there’s a way of choosing where Corona puts the Project Sandboxes. It is slightly inconvenient, but I just open it up at the start of a session and leave the finder window open.

Files cannot be saved to the resources directory on the device so allowing this on the simulator could lead to problems I guess.

Actually the simulator’s behavior is really what it should be.  We basically take everything in the folder with main.lua and package that into the app bundle which is READ ONLY.  You cannot write to system.ResourcesDirectory.  There are a couple of reasons why this is a good idea.  Let’s say that system.DocumentsDirectory did resolve to a folder called Documents inside your app’s project folder.  You could then use system.resourcesDirectory and a path like Documents/filename to access it.  This would fail horribly on device because that directory structure isn’t real.  Next you would end up with your testing files being distributed to your users.

Since you should be using the directory constants:  system.ResourcesDirectory, system.DocumentsDirectory, system.CachesDirectory and system.TemporaryDirectory, code wise it doesn’t make sense to worry about where the files are. 

Rob