I have a Cocoa application which reads and saves data in a sole file. This file is, in fact, a piece of the app; you can think about it as a configuration file. What would be the best place to save this file? Inside the <App name>.app/ dir? In some hidden directory at the user’s home?
Thanks in advance?
Don’t put it in the
.apppackage. It might not be writable for the user, and the settings file will then be global, not per-user.The most appropriate place is probably in the user’s application support directory:
~/Library/Application Support/FooApp(whereFooAppis the name of your application). You can build a path to this directory with the following bit of code (which may need to be adapted slightly to your purposes):