Including Databases in Build

Hello there,

My game uses two SQLite databases. One of these is used to save progress and is in the Documents directory, and the other is used to build levels and is in the Resource directory. When I run my game in the Corona simulator, everything works just fine. However, when I build for the Xcode simulator or an iPhone, the game will not start up because it can’t connect to/find/access the databases. Is there something special I need to do, or somewhere I need to put them, to ensure they are included in the build and referenced properly?

Currently, the two database files (resources.db and progress.db) are in the same directory as main.lua.
In the sandbox, both of them are in the Documents folder.
In the code, I am using the standard method of referencing them:
system.pathForFile(“progress.db”, system.DocumentsDirectory)
system.pathForFile(“resources.db”, system.ResourceDirectory)

Thank you for any assistance!
[import]uid: 36054 topic_id: 7069 reply_id: 307069[/import]

I’ve managed to narrow the problem further since my post. The game is able to load levels if I skip checking for progress. Therefore, it is properly finding and reading the resources.db database in the Resource Directory.

However, it is unable to reach progress.db in the Documents directory. My suspicion is that I can’t put things into the Documents Directory by simply having them in the same directory as main.lua and having something in build.settings and that Corona Simulator might have been finding it regardless of that.

It seems like, the first time the application loads, it needs to check the Documents Directory for the database, and if it is not already there, it needs to copy it over from the Resources directory, where all my databases start out

What I posted above seems to have been exactly correct and I am up and running. No more help needed :stuck_out_tongue: [import]uid: 36054 topic_id: 7069 reply_id: 24800[/import]

You may not have needed the help, but I was just wrestling with this very idea, so it was good to see that someone has already done what I was thinking of doing. :slight_smile:

Now off to look at file i/o api’s. Yay… :wink: [import]uid: 42145 topic_id: 7069 reply_id: 49819[/import]