Re: CFPreferences
Re: CFPreferences
- Subject: Re: CFPreferences
- From: Uli Kusterer <email@hidden>
- Date: Fri, 27 Jan 2006 19:13:48 +0100
Am 27.01.2006 um 18:39 schrieb Tom Harrington:
On 1/27/06, Alan Smith <email@hidden> wrote:
I need to get to the desktop preference file and read the
"ImageFilePath".
But I need it as a string to be able to display it in a text
field. I've
tried CFPreferencesCopyAppValue but can't find a way to convert
the returned
value to a NSString, at least not a way that works.
´to get an NSString is typecast it. If the return value in your case
is a CFStringRef, you can just cast to NSString *. If it's some other
plist type, cast to the appropriate class. If you're not sure what
type you have, you can use CFGetTypeID (or just debug the app and use
"po").
IIRC, that's actually an alias stores as an NSData in this particular
case, so it isn't at all surprising if it's hard to get a string out
of this. Use NDAlias or BDAlias to turn that back into an alias and
extract an NSString with a path from that.
One suggestion for the future: You can edit nearly all the
preferences files in (~)/Library/Preferences/ using Property List
Editor.app, which will also show you their hierarchy and data types.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden