Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

newformac

macrumors regular
Original poster
May 24, 2011
107
0
Hi all,

i m create a file in "/Library/Preferences/file.plist"
its working fine when i handle this from admin but when i m trying to create or write from other user its not done.

i want to ask the location where each and every user of pc can easy access (create/read/write) file and folder.

thanks in advance.
 
You are only "guaranteed" read/write access for the user in their own home directory.

And don't hard code paths. Use NSHomeDirectory(), NSSearchPathForDirectoriesInDomains(), etc. to find common folders.
 
this gives the path of currently login user.

so when i create the file in this location and if i login with another user how can i access this file.

i want to access a single file by all users.
 
Hi all,

i m create a file in "/Library/Preferences/file.plist"
its working fine when i handle this from admin but when i m trying to create or write from other user its not done.

i want to ask the location where each and every user of pc can easy access (create/read/write) file and folder.

thanks in advance.

1. DON'T DO THAT!!!!

Preferences are per user. They NEVER go into /Library.

2. DON'T DO THAT!!!

Use NSUserDefaults to handle all the preferences. Do NOT create files yourself.

3. Use NSWorkspace to find where to put files. Especially if you want to ever get an app on the app store.
 
please tell me how?

Let me see...

If you are using XCode 4, Press Command-Shift-2, then click on "Documentation".

As a little test, how would you get the shared NSUserDefaults instance?

If you can't find out, you should give up writing software.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.