Hacker News new | ask | show | jobs
by someone7x 3237 days ago
I'm not GP, but I recently sank time into trying to change Finder searches to default to the current directory instead of my entire machine. It mildly infuriates me that I can't change this; I gave up after I saw com.apple.finder.plist is not plaintext.
2 comments

Plist files have two standard encodings, an XML-based textual one and a binary one. You can use plutil to convert between the two, e.g.

    plutil -convert xml1 com.apple.Finder.plist
However, for preferences you probably want to use the `defaults` command instead, because IIRC they’re managed by a daemon (cfprefsd) that might not notice if you modify the backing files while it’s running.
When someone decides a config file needs two different serializations and a daemon, I'm reminded of https://www.jwz.org/doc/mailsum.html.
The two different encodings aren't just for config files; property lists are used throughout the OS for all sorts of things. They're a serialization of standard data structures such as arrays and dictionaries: same idea as JSON, decades before JSON. In retrospect, the XML-based text format is excessively verbose, but back then XML was all the hotness… As for the binary format, well, even given JSON's relative succinctness, there are many different formats that attempt to fill the role of 'binary JSON' (BSON, BJSON, JSON-B, MessagePack, CBOR, UBJSON, Fleece, PSON). It's just that none of them have become ubiquitous, probably because of some combination of fragmentation and the lack of built-in browser support.

As for the daemon, among other benefits, it allows preference changes to be immediately visible across all processes on the system, rather than requiring manual action to reload from disk. See:

https://developer.apple.com/library/content/releasenotes/Dat...

Default search scope is an option in the Finder's preferences window and has been ever since 10.7...