Le 10 juin 09 à 11:51, Ken Thomases a écrit :

On Jun 10, 2009, at 4:27 AM, Rick C. wrote:

to be more specific on what i'm trying to do i would like to be able to review the files in a preferences folder and find the related app on the system. so i was trying to come up with a list of identifiers for comparison. but it seems that some files in a preferences folder (plists) do not match up with the identifier of the related app. maybe this is due to the fact that a single app can create multiple plist files. any input on how i can achieve what i'm trying to do?

It's not generally possible to go from an arbitrary file to some "related" app. And the files in the .../Library/Preferences folders are effectively arbitrary. Sure, the vast majority of them are created by the CFPreferences or NSUserDefaults APIs, in which case they are probably named after bundle IDs, but some apps just write files directly to those folders. Those apps don't always name their files using their bundle IDs.

No need to write file directly in the Preferences folder, you can pass any identifier when you use (low-level) CFPreferences API.

Even if you do assume that those files are named after bundle IDs, then it seems strange to try to go from the list of all application bundle IDs to the files. Why not go from the file names, parsing out the bundle IDs, to the apps? It's easy enough to look up or manipulate an app given its bundle ID.

Lastly, you might be working from the files when you should be working from preference domains. The frameworks currently work in terms of .plist files, but there's no guarantee that they will in the future. They may start working in terms of some unified database, or whatever.


And they will call it the Registry ;-)


_______________________________________________

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