Best Practice for Deploying App with SQLite DB

Hi All,
I have built an app which works on my local Win7 PC, which I will eventually deploy to my customer’s MAC OSX laptop.
My question really concerns how to maintain the connection between App and SQLite database.
In the XOJO IDE I have added a Database Class via the Insert>Database>New SQLiteDatabase menu of the IDE. The physical .sqlite file is found in my c:\users\username\documents\appdata\roaming folder. If I build a standalone Windows build, the standalone runs and functions fine. If I deliberately move the .sqlite file to another folder location, then any attempt to start the app will generate a “database not found” error, and the App will close.

What I would like to achieve is a dialog which, in the event of database not found during app startup, which would allow the user to navigate to the physical location of the .sqlite file, perform the connection, and store that path so that next startup will connect without error.

I just can’t figure out how to do this:-
1/ what event should code be in (Application Open??),
2/ how do I check / trap the database not found error?
3/ how do I access / change the path that is stored in the Database Class object

or, is there a better way to approach this matter?

All suggestions gratefully received!

Be mindful that a lot of Windows users are not aware that there is a AppData hidden folder. Files stored there are not really files that the user should be aware of as they are application support files. So you can’t really rely on them to know what they are looking for and where it might be (nor why it moved in the first place).

However if you consider the database more of a document that they are both aware of and they create willingly through the application then save it to Documents. That way they can manage it on their own.

It sounds like you are the former though. In that case I’d recommend just recreating the database if its lost for some reason.

Thanks Phillip.
The current file location was not chosen by me, but that’s where XOJO put it.
I would much rather the db was stored in the user’s “Documents” folder, but (a) not sure how to do that (b) even if I could move the db to my own machine’s “Documents” folder (and re-create the db class link to it), how well will that deploy on other machines / platforms?

Well you could ask the user where to locate the DB and give them the choice.
Then your app just has to keep track of that location.
I’d do that entirely in code - not with an instance dragged into the project.