Re: Why Won't CFPreferencesCopy[App]Value Read Alias?
Re: Why Won't CFPreferencesCopy[App]Value Read Alias?
- Subject: Re: Why Won't CFPreferencesCopy[App]Value Read Alias?
- From: Chris Parker <email@hidden>
- Date: Wed, 10 Aug 2005 12:57:03 -0700
On Aug 10, 2005, at 12:13 PM, Jerry Krinock wrote:
My app can read its license information from the any-user
preference domain
on the current host, (thanks to my having trudged through
MoreAuthSample a
couple months ago). To read the information from the any-user
domain, I
call:
CFPreferencesCopyValue (myKey, myBundleID,
kCFPreferencesAnyUser, kCFPreferencesCurrentHost);
Today, I replaced the targetted .plist file in /Library/Preferences
with an
alias of the same name and extension. The target of the alias is
the actual
.plist file which is on another host on our network. I thought
this would
be a nifty way to implement a network license server. If I
doubleclick on
the alias in the Finder, Property List editor opens and shows the
License
Information; i.e I certainly have access to the target.
But when my app runs, the above call returns NULL if I have this
alias in
/Library/Preferences instead of the actual file.
I have tried changing the last argument to kCFPreferencesAnyHost,
and also I
have tried calling CFPreferencesCopyAppValue instead. Same result.
Why won't these functions go for my alias?
Because CFPreferencesCopyAppValue doesn't resolve aliases when it
looks up the domain. A symlink will may for reading, but will be
blown away and replaced with a real plist file when new values are
synced into the domain.
Aliases in Mac OS X aren't resolved automatically by filesystem calls
as symlinks are. Any link whether it's a symlink or an alias requires
special handling for the safe-save mechanisms we use to try to make
sure we don't lose your preferences or other files.
.chris
--
Chris Parker
Cocoa Frameworks
Apple Computer, Inc.
_______________________________________________
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