简体   繁体   中英

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 Files 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM