> I want to try and map each app preference to an application, so I can > identfy any 'orphan' preferences. > > I thought about using SysCreateDataBaseList using type 'appl' but I'm > guessing not all resources with access to the prefs DB are type 'appl'.
Apps can create preferences with any creator ID they want; it doesn't have to be their own. So enumerating the apps on the device is only useful to find the "legit" prefs. And other kinds of things besides apps could have preferences: shared libraries (including exchange libraries), hacks, etc. You could make a list of types: 'appl', 'libr', 'exgl', etc. The problem is not all "code objects" have fixed types; e.g., shared libraries are usually of type 'libr' but they can have any type. You could enumerate all databases, regardless of type, but this is likely to include "orphan" databases. These would then cause the corresponding orphan preferences to stick around too. > I want to work with the preferences DB (PrefOpenPreferenceDB) but I don't > want to mess around with the system prefs. Are they stored in either of the > databases returned by this function? If so, how do I identify them? The other side of your problem is to enumerate all the preferences. I think you can do this with PrefOpenPreferenceDB and enumerating the resource database, as you've suggested. (There are actually two databases, one for save and one for unsaved.) I don't know which components of the OS store prefs. For compatibility, you'd probably have to avoid touching any with an all-lowercase creator ID. Even then, you may get a few false positives or false negatives; people don't always follow the rules. You might want to write info about the deleted prefs to a log for debugging purposes. I'd limit your app to running on OS versions and devices it's been tested on. Even then, it's a bit risky. -- Danny @ Palm -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
