Can macosx register an UTI with a dot in the extension?

269 views Asked by At

I've read Apple's Introduction to Uniform Type Identifiers Overview and Technical Q&A QA1587 but there is no information on how to register an extension with a dot, like filename.nimrod.cfg where the extension is not just .cfg but .nimrod.cfg. The plist definition I'm using is the same as for single extensions:

    <dict>
        <key>UTTypeIdentifier</key>
        <string>org.nimrod-lang.cfg.nimrod</string>
        <key>UTTypeReferenceURL</key>
        <string>http://nimrod-lang.org/</string>
        <key>UTTypeDescription</key>
        <string>Nimrod configuration file</string>
        <key>UTTypeIconFile</key>
        <string>public.text.icns</string>
        <key>UTTypeConformsTo</key>
        <array>
            <string>public.text</string>
            <string>public.utf8-plain-text</string>
            <string>public.source-code</string>
        </array>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>public.filename-extension</key>
            <array>
                <string>nimrod.cfg</string>
            </array>
        </dict>

However, when I debug preview one of these files the qlmanager tells me the file is not being registered:

[DEBUG] Registering <QLGenerator /Users/gradha/Library/QuickLook/QuickLook reStructuredText copy.qlgenerator> for org.nimrod-lang.nim
[DEBUG] Registering <QLGenerator /Users/gradha/Library/QuickLook/QuickLook reStructuredText copy.qlgenerator> for org.nimrod-lang.cfg.nimrod
[DEBUG] Preview test for nakefile.nimrod.cfg -- file://localhost/Users/gradha/project/nimrod/ql-rest-nim/. Content type UTI: dyn.ah62d4rv4ge80g3xh

So it looks like the UTI is being registered, but the double extension not being correctly recognised. How can I make QuickLook detect these files properly?

1

There are 1 answers

3
Motti Shneor On BEST ANSWER

Actually, this is obvious. The UTI standard tells you that a period in the UTI string is a decider in the reverse-order chain of classes.

So --- It was parsed and used correctly. Don't have a period in your UTI parts. replace the with something else within the standard.