knurling / ServiceStation

Service Station
37 stars 1 forks source link

RTFD recognised as Folder #32

Open gilby101 opened 4 years ago

gilby101 commented 4 years ago

RTFD documents (and perhaps some other composite documents) are included in the ServiceStation definition of a Folder. So ServiceStation offers to open an RTFD document with Terminal. This can be fixed by changing the definition of Folder to be "Uniform Type Identifier is public.folder".

pkamb commented 4 years ago

The Kind is Folder check is using the UTI public.directory aka kUTTypeDirectory.

The Kind → Directory row has more specific options, which you can use instead of writing your own UTI query:

Localized CFStringRef UTI
Any Directory kUTTypeDirectory public.directory
Folder kUTTypeFolder public.folder
Volume kUTTypeVolume public.volume
Package kUTTypePackage com.apple.package
Bundle kUTTypeBundle com.apple.bundle
Application Bundle kUTTypeApplicationBundle com.apple.application-bundle
Plugin Bundle kUTTypePluginBundle com.apple.plugin
Framework kUTTypeFramework com.apple.framework
Wevah commented 4 years ago

I'd have expected Kind is Folder to be false if the file is also a package.

gilby101 commented 4 years ago

That is what I would have expected. Both Folders and RTFD have UTI public.directory (i.e. any directory). Folders also have public.folder. Service Station now has (has always had?) Kind → Directory with some nice subtypes corresponding to the UTIs in the table above. I am not sure if an upgrade to 2020.5 fixes that automatically, but I have now changed my definition of 'Folder' rule to be Kind → Directory with subtype Folder. All good, though it pays to understand UTIs to debug issues - use Terminal with the mdls command.

pkamb commented 4 years ago

I think what happened is that for Kind is ... I chose the top-level UTI for "directory", which is kUTTypeDirectory / public.directory.

But then in the UI I changed that to the more user-friendly localized "Folder".

For the Kind → Directory row I didn't make that localization change, so Folder there refers to kUTTypeFolder / public.folder.

I should perhaps change that "Folder" localization back to "Directory". Or, change the UTI in the Kind is Folder selector to instead use public.folder.

gilby101 commented 4 years ago

My view:

The simple Kind is Folder should refer to what everyone thinks of as a folder in Finder, that is UTI public.folder. Then there is no confusion with packages.

At the same time, I very much like the Kind → Directory (and the other Kind →) with their subtypes allowing the user to choose precisely without having to know about UTIs. It doesn't matter if the Kind → Directory → Folder is the same as the simple Kind is Folder.