1

I am deploying a Delphi Firemonkey app on Mac OSX and being new to Mac programming I am wondering where I should install the sqlite database file.

Under Windows I usually put it in the application installation directory but this isn't appropriate on a Mac (I think!).

There will not be a need for multi-user access to the db file

I have currently placed it in /Library/Application Support/Myapp/Myapp.db but wonder if there is a better (or official) place to put it.

Peter
  • 61
  • 1
  • 3
  • You might find this useful http://stackoverflow.com/q/8159485/1026660 – Joucks Jan 31 '17 at 09:55
  • On a side note, the application installation directory is *not* the place to put any writable data. That directory is read-only, has been since Windows Vista. If you are writing to this directory, then your design is flawed, and you're taking a back door. Take a look at `TPath.GetHomePath` as found in `System.IOUtils`. – Jerry Dodge Jan 31 '17 at 16:31
  • Yes I realise that. Thanks – Peter Feb 01 '17 at 09:17

1 Answers1

2

I'd suggest that you take a look at the guidelines from Apple.

You can use '/Library/Application Support/Myapp/Myapp.db' if the database does not contain user specific data. Otherwise use '~/Library/Application Support/Myapp/Myapp.db'.

Please don't hard code those folders, but use NSFileManager.URLForDirectory for retrieving them.

Sebastian Z
  • 4,520
  • 1
  • 15
  • 30