Re: Foundation tool & NSUserDefault
Re: Foundation tool & NSUserDefault
- Subject: Re: Foundation tool & NSUserDefault
- From: KK <email@hidden>
- Date: Fri, 12 Jun 2009 07:18:13 -0400
Yes... I see. Thank you.
My other question is, can you change where this .plist file goes? My tool
runs as root, so when I use NSUserDefaults, it saves the .plist file in
/private/var/root/Library/Preferences, but I would prefer that it go right
in /Library/Preferences ... is this possible?
On Thu, Jun 11, 2009 at 12:10 PM, Nick Zitzmann <email@hidden> wrote:
>
> On Jun 11, 2009, at 5:19 AM, KK wrote:
>
> I am writing a "Foundation tool" - a command-line utility that uses
>> Objective-C and the Foundation framework, and I'm trying to save
>> preferences
>> under the application domain.. My understanding is that you would need a
>> bundle identifier to do this, but if it's just a tool, can it have a
>> bundle
>> identifier?
>>
>> Or, do I have to use CFPreferences?
>>
>
>
> You can use CFPreferences if you wish, but if you use NSUserDefaults, the
> defaults will be written to a plist file with the same name as your
> executable if it has no bundle identifier. That might be good enough unless
> your tool has a very common name or something.
>
> I haven't tried it, but I've read on ADC that there is a way to embed an
> info.plist file in a tool by using this linker flag:
> -sectcreate __TEXT __info_plist $(SOURCE_ROOT)/$(INFOPLIST_FILE)
>
> Nick Zitzmann
> <http://www.chronosnet.com/>
>
>
_______________________________________________
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