开发者

Where can I store my application's files?

Well, I'm new to the Mac OS X platform and seriously I don't know anything about it. I mean on Windows I just store it at the Program's Fil开发者_开发百科es directory, What about the Mac, is there any recommended place to put the files?


Resources related to your application that will not be changed after the app is installed going into the app wrapper (see documentation).

Cached data that can be deleted at any time goes in ~/Library/Caches.

Supporting data that should generally be persisted, but isn't document data, goes in ~/Library/Application Support.

Documents and user data that is primary to the purpose of your app goes in ~/Documents, generally.

Preferences go in ~/Library/Preferences, but are generally read/written entirely via the NSUserDefaults API.


~/Library/Application Support/YourAppName/yourFilesHere

This way the files will be personal to the user using your app. If you want tho files to be global they should be in your app bundle/Resources/

To get the home directory ( the tilde ~ ) you can use NSHomeDirectory or you could use [@"~" stringByExpandingTildeIntoPath];


You can store your application-created / application-deependant files in ~/Library/Application Support/YourApp/Files. Otherwise, user created Documents would most likely be best stored in the Documents directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜