I was working on some code to uninstall an application, and was pleasantly surprised to find that Cocoa’s NSUserDefaults class will remove the application’s preferences file from ~/Library/Preferences if you remove all the keys:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSArray *keys = [[defaults dictionaryRepresentation] allKeys]; int i, count = [keys count]; for (i = 0; i < count; i++) { [defaults removeObjectForKey:[keys objectAtIndex:i]]; } [defaults synchronize];
It’s not often you find uninstall options for OS X applications, but it’s nice Apple’s engineers thought about this case and handle it appropriately.
Are you sure you were not looking at vista… just kidding. LOL