On Feb 13, 2009, at 5:34 PM, Ken Thomases wrote:

Contrary to I. Savant, I don't think going through NSUserDefaults or CFPreferences will work. It still won't inform the necessary processes of the change in an active manner.


You're likely right - the process in question would have to be listening for changes to its preferences, which it's probably not. However, my point was to illustrate that merely changing a plist is the absolute least likely to trigger the desired change in the active application / system process using that plist as a persistent store for the state of its preferences. Let alone the 'tradition' of unceremoniously killing a process to force it to load that changed plist ...

In any case, even if you're sure you fully understand what preference keypaths are used for a given function (ie legacy preferences that have been migrated or simply deprecated), you still need to worry about your direct-file-manipulations clobbering (or being clobbered by) a flush from the preferences system in the given domain. Wanna' take that chance with your user's system that you know all the pros and cons? :-)

It's for this reason that the 'traditional' way to add a shortcut to the Dock is considered dirty and wrong (modifying its plist and forcibly killing the process to force it to reload its preferences when it respawns), which is only necessary because of a lack of public API.

Of course in this case, it appears AppleScript will do the job (I wouldn't know - I've never attempted what the OP is attempting). That's a considerably better option. :-)

--
I.S.

_______________________________________________

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