开发者

Cocoa Createfileapath

开发者 https://www.devze.com 2023-01-12 22:45 出处:网络
I am trying to create a file on mac os. the data from the file will be accessed by the app. but how to create a file havin开发者_StackOverflow社区g read permission on all accounts. Currently the app c

I am trying to create a file on mac os. the data from the file will be accessed by the app. but how to create a file havin开发者_StackOverflow社区g read permission on all accounts. Currently the app can read data in admin account only. I am using following syntax:

BOOL B = [fm createFileAtPath:p1 contents:data attributes:nil];

is it something to do with attributes so that it can be read by all the users but can be modified by admin only.

thank you.

Here is the output of the ls -dl

-rw-r--r--  1 macuser  wheel  137 Aug 23 09:49 /System/Library/testapp/info.txt

is it because I am creating file in system/library, if so which is the best place to create a file so that it will be readable by all users but can be modified by admin only.

thank you


is it because I am creating file in system/library,

That's always the wrong place to put something, unless you're Apple or installing a kext.

… which is the best place to create a file so that it will be readable by all users but can be modified by admin only.

Install it somewhere in /Library.

Your application-specific files should not go in a direct subfolder of /Library, but in a subfolder of /Library/Application Support.

0

精彩评论

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