Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mac OS X: Where should I store common application data?

Tags:

What's the standard path on MacOS X for storing application data that is to be shared by different users? I am not talking about temporary data, but data which is used by one particular program on a regular basis and belongs to no particular user. For example a game highscore table.

Thanks,

Adrian

like image 380
Adrian Grigore Avatar asked Feb 20 '09 08:02

Adrian Grigore


People also ask

Where are application data stored in Mac?

Application data for apps that you bought via the Mac App Store goes in your ~/Library/Containers directory (this is basically ~/Library/Application Support for sandboxed applications).

Which application is used to view and organize files and folders in macOS?

Finder. You can view and organize your files and folders using a built-in application known as Finder. To open Finder, click the Finder icon on the Dock, or double-click any folder on your desktop. A new Finder window will appear.


2 Answers

I believe you're talking about Support files - a file that supports the application but is not required to run (your highscore table for example).

These files should be put in ~/Library/Application Support/YourApp or /Library/Application Support/YourApp for shared users.

The Library Directory Stores App-Specific Files

like image 159
Palm Avatar answered Sep 23 '22 03:09

Palm


To get the directory, you can use the function "NSSearchPathForDirectoriesInDomains", with the directory parameter being "NSApplicationSupportDirectory", and the domainMask parameter being "NSLocalDomainMask".

(NSApplicationSupportDirectory is the "Location of application support files", while NSLocalDomainMask means "Local to the current machine—the place to install items available to everyone on this machine.")

like image 42
Heng-Cheong Leong Avatar answered Sep 21 '22 03:09

Heng-Cheong Leong