views:

21

answers:

1

hello,

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 having 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

+1  A: 

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.

Peter Hosey
Thank you very much. It worked perfectly for me. sorry could not give a vote up though..still under minimum required reputation :-|
Aniket