Re: plist parsing in c
Re: plist parsing in c
- Subject: Re: plist parsing in c
- From: Keith Duncan <email@hidden>
- Date: Mon, 07 Jul 2008 02:02:07 +0100
The only reliable* way to access system preferences is through the
CFPreferences API which NSUserDefaults is built on.
CFURLCreateDataAndPropertiesFromResource() and
CFPropertyListCreateXMLData() for read.
CFPropertyListCreateXMLData() and
CFURLWriteDataAndPropertiesToResource() to write.
I'm afraid you're missing the point; think of the PLIST files simply
as a convenient representation of the defaults database. There is no
guarantee that preference domains outside your control will remain;
named consistently, where you expect them, nor in any particular
format. The format of the defaults database is maintained by the
CFPreferences API and should only be accessed through it.
From the docs:
Preferences files are stored in the system’s or user’s preferences
directories. On Mac OS X versions 10.0 to 10.4 these are in /Library/
Preferences and in /Library/Preferences in the user’s home directory
respectively. When debugging an application, it may sometimes be
useful to inspect these files to determine that preferences have
been saved correctly, however you should never hardcode these paths
into an application. If you do need to access the directory
programmatically you should use the
NSSearchPathForDirectoriesInDomains API, although there should
typically be no reason to do so.
It's all very well that you can read and write to them directly; but
it really isn't advisable. I'm certain the docs state NOT to assume
the preference format either though I can't find it now, you simply
need to take package receipts as an example though.
Keith Duncan
email@hidden, 33software.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