views:

14

answers:

1

I am planning to develop a cross-platform script. On Linux and other operating systems, it will store configuration in XDG_CONFIG_HOME and data files (specifically, downloaded plugins) in XDG_DATA_HOME. On Windows, it will use APPDATA for both (unless someone has a better idea). However, what would be the proper thing to do on Mac OS X?

On my first glance through a handy Macbook's ~/Library directory, I saw Preferences and Application Support folders. I was originally planning to use those, but Preferences seems to just contain plists with reverse domain names like com.apple.foo.bar.baz.plist, and every folder in Application Support corresponds to a bundle in /Applications, so I'm not sure how well the system would react to files that don't match its standards. Storing them directly in ~/Library might be an option, but I don't want to pollute it with a stray myscript.conf file if there's a better place for it.

Where should I store these files? (And please don't say just ~/.myscript. I know it's the Unix tradition, but it annoys me to see random dotfiles in the home directory.)

+1  A: 

I would use ~/Library/Application Support/script_name/. The subdirectories inside Application Support are used conventionally by various apps, including Apple's own softwares. But it's not enforced by the OS and not tied to apps inside /Applications. So you're perfectly free to create your own directory in it.

For the directory structure of OS X in general, see this Apple document.

Yuji
Okay, cool. Is this suitable for configuration as well, or just data files?
LeafStorm
Both are fine. I added to the answer an official document as a reference.
Yuji