When I edit code, sometimes loading save file doesn't work afterwards

Hi!

I’m developing a simple game and I use JSON to save a table that contains my game state values that I want to load when the application is started.

The system works ok, but sometimes when I edit the code and restart the program, the loading part doesn’t cause any errors, but the game state is returned to the initial situation.

Before I start looking into this more properly I just thought of making sure that this is not something that is “working as designed” regarding the Corona simulator.

Is there some feature that if you edit the codebase and recompile the program for the simulator, the framework deletes the old save files or something else causes the old saved files not to be used when the program starts? 

Your app may be getting given a new temp directory in the working space. You can check this in the terminal by looking at the path that the app is being run in. If you notice it has changed, it will run as if it is a fresh install. I don’t know why the Corona sim does this, but I’ve not found any documentation for this behaviour anywhere. Strangely, my current in-dev app, which I’ve been working on for 3 months, hasn’t had a new temp directory given to it ever.

Ah, ok cheers, have to check that one!

Your app may be getting given a new temp directory in the working space. You can check this in the terminal by looking at the path that the app is being run in. If you notice it has changed, it will run as if it is a fresh install. I don’t know why the Corona sim does this, but I’ve not found any documentation for this behaviour anywhere. Strangely, my current in-dev app, which I’ve been working on for 3 months, hasn’t had a new temp directory given to it ever.

Ah, ok cheers, have to check that one!