Preview any file from a macOS Bookmark, and an oddity in Quick Look

Here is a new release of the Precize-Preciziun pair of apps for exploring file sizes, inode data, and Bookmarks. Although Precize remains at version 1.0b4, I have managed to get a preview feature working in Preciziun which I think may prove very useful. I had intended to include it in the first release of Preciziun, but couldn’t get it to work, so I ripped that code out for 1.0b1.


This adds a Preview button to Preciziun. Resolve a pasted-in Bookmark, then when you click on the Preview button the document will be opened using Quick Look. This in turn enables you to open it using the default editor for that type of document, so should save you messing around in the Finder.

The new combined release is available here: precize10b4a
and in Downloads above.

When you use Preview, you will notice that it has a slightly odd side-effect: after clicking on the button, the regular and volfs paths in the lower text view are both selected. This is what I had to do to get Quick Look to work.

In the previous version, I had added the fairly minimal code necessary to support previewing the document, but no matter what I did, the Quick Look preview always opened with an empty document. I later went back and had another go at trying to get the feature to work. I then discovered that, if I selected the URL path in the lower text box first, I could get a Quick Look preview correctly.

I then jumped to the wrong conclusion, that somehow the selected path was being fed into Quick Look, which it wasn’t. In fact, all I needed to do was place the text insertion point in the lower text view, rather than the upper. So in this version, immediately before asking Quick Look to preview the document, the app selects all the text in the lower text view; there doesn’t appear to be an easier way of working around what I can only presume to be an odd bug.

Lesson: if you’re writing code to open a Quick Look preview, and it doesn’t seem to work, try putting the insertion point in a different view within the window. Although you might think that all its views should come under the same ViewController, in practice some do, and some may not.

In tomorrow’s Last Week on My Mac column, I’ll try to round up what I have learned this week about volfs, inodes, and Bookmarks in a more complete and coherent way.