tags:

views:

625

answers:

4

Hi,

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

A: 

I'm nowhere near OS X development, but I was under the impression that all application data are inside the folder of the .app-lication, which is why .app files are usually massive, including all data inside.

LiraNuna
This is not correct. All essential files belong in the application bundle, but an app should never alter the contents of its bundle while it's running. Supporting files belong in the Application sUpport folder as explained by Palm.
Chuck
+1  A: 

Some applications put files into the /Users/Shared-directory. I know it's the standard way to share files between users, but I'm not 100% sure it's thought for application data storage.

The there's the /Library*-folder which is thought for systemwide common data, similiar to the /Users/Usernames/Library.

But you certainly shouldn't write data to the Application.app-directory. Users without admin rights won't even have the right to write to these directories.

* = Or /System/Library. Need to verify.
christian studer
+4  A: 

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.

Where to Put Application Files

Palm
+1  A: 

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.")

Heng-Cheong Leong