开发者

Mac OS folder locations

We have an application that we're porting to Mac OS from Windows. Once installed, the user can customize the functionality of the application by editing certain approved "data files" with a text editor. Once saved, the application can be reloaded to compile and load the contents. A core part of the program is the editing and sharing of these data files, and the program provides a friendly interface to allow the user to edit them.

On Windows, these folders are located under a standard folder, accessed through a shell constant, that our installer makes accessible to all users. Once installed, any user can run the application and edit the data files it uses.

What is the equivalent folder to use for the mac? Is开发者_如何转开发 there somewhere we can put stuff that is accessible to all users normally, or do we have to flag it as "all users can access" somehow?

Edit: A couple of users have suggested /Users/Shared. Aren't files in /Users/Shared still limited somehow to the user who created them? I remember trying to copy files between accounts in /Users/Shared, and I had to "take ownership" of the files in /Users/Shared before I could do anything with them.


Read this document. It has a section on where to put application files. I doubt /Users/Shared is the right directory for what you want to do; a subdirectory within /Library/Application Support/ is probably more appropriate. Remember, though, that non-admin users will not be able to write there by default. In that case, you can fall back to using the corresponding directory in the user's home folder.

Don't hardcode paths to special directories. Rather, you should use the NSFileManager methods URLsForDirectory:inDomains: or URLForDirectory:inDomain:appropriateForURL:create:error:, or the Folder Manager from Carbon if you're not using Objective-C.


/Users/Shared on a Mac is a folder available to any user. Hope this helps.


Use /Users/Shared/your_application_name .

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜