OSX: Where to store the SQLite file for the application?

My OSX Cocoa application uses SQLite to manage data. During initialization, I need to specify where the database file will be stored.

What is the standard way to handle this?

This database file should be launched (the application will create it if it does not exist), and the data should be stored forever even after software updates, if possible.

Where to store it? Application folder? Support files?

thanks

+4
source share
3 answers

The agreement is to save it in the application support folder. i.e. in ~/Library/Application Support/*YourAppName*/database.db

You can find the application support you are looking for with

 NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); 
+9
source

In the application support folder for your application.

Take a look at the setup of the Core Data project, which shows how this is usually done by other applications. Or use Core Data for your own application instead of SQLite files.

+2
source

It looks like it should be in the application support folder.

+1
source

All Articles