To get that level of control, you'll need to use CFPreferences:

CFPreferencesSetValue(key, value, bundleID, kCFPreferencesAnyUser,
kCFPreferencesCurrentHost);
if(!CFPreferencesAppSynchronize(bundleID)){
        // Handle failure
}

-Sidney


On Fri, Jun 12, 2009 at 7:18 AM, KK<kthem...@gmail.com> wrote:
> 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 <n...@chronosnet.com> 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 (Cocoa-dev@lists.apple.com)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/s%40sidneysm.com
>
> This email sent to s...@sidneysm.com
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to