|
mac geekeryGet your geek on. |
One-Line Plist CheckerMarch 10, 2006 - 8:17am
Property lists are everywhere. Every time a program saves a preference, it’s into a property list. Every time the system saves simple information, it’s to a property list. Almost every single file in ~/Library/Preferences/ is a property list. Every last one of them, before Tiger, was in XML as well. I tend to think one of the reasons Apple moved to binary property lists in Tiger is because XML is a very strict language and very simple errors can cause some very funny problems with the file, including it just not loading at all. As such, there are a lot of little shareware or freeware apps out there to check the validity of all of your property lists and make sure that’s not the cause of any problems you’re having with the system. Of course, why pay for something that’s built-in? The system has a utility, The default action for find ~/Library/ -name '*plist' -exec plutil {} \;
This will find every find ~/Library/ -name '*plist' -exec plutil {} \; | grep -v ": OK"
Now only the errors will show up. When you do get an error, you’ll see an error message with the exact line that has an error, what it expected, and what it got (for XML plists). Just open the file up in a text editor that shows line numbers (or goes to them, at least) and see what could be wrong. You’ll never go wrong removing white space in between the tags and data if you’re getting an error like the following:
foo.plist: XML parser error:
Unknown character '
' (0xa) in <integer> on line 168
Old-style plist parser error:
Malformed data byte group at line 1; invalid hex
</integer>
Removing the space around the integer value solved the problem and saved the file. This is also a good trick to use on the main Library folder if you’re seeing general system “fun” and don’t know where to start. Now, this won’t check the values in the property list, so if you have the wrong settings you’re SOL with this method, but it will make sure integers have integers, arrays have members, and so on. If you’ve hand-edited a property list, this should be done afterwards to make sure it’s still okay. About Adam Knight |
|
||||