Re: Writing global preferences file into /Library/Preferences (OS X Lion)
Re: Writing global preferences file into /Library/Preferences (OS X Lion)
- Subject: Re: Writing global preferences file into /Library/Preferences (OS X Lion)
- From: "Stephen J. Butler" <email@hidden>
- Date: Wed, 20 Jul 2011 21:30:31 -0500
On Wed, Jul 20, 2011 at 8:31 PM, Peter C <email@hidden> wrote:
> Some of the programs I wrote save a preference file into /Library/Preferences via NSDictionary. This serves as a general settings for all users. Many other 3rd party software (Skype, Microsoft and etc) saves preferences file into this directory too. This works from 10.0 to 10.6.
It was a bad design decision to assume you could ever write to this
directory. What if your user isn't running as admin?
The way to solve this issue is to use the BetterAuthorizationSample library:
http://developer.apple.com/library/mac/#samplecode/BetterAuthorizationSample/Introduction/Intro.html#//apple_ref/doc/uid/DTS10004207-Intro-DontLinkElementID_2
Basically, you write a helper tool that runs as root, and comunicate
with it what settings get what values. Then the helper tool, as root,
saves the plist.
Read and understand all the included txt files before you just dive
into the code!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden