UTI associations and file extensions

In my application, I wanted to include the QuickLook plugin, which reads a non-system extension, and other applications also use it (let's use RAR for this example). I declare the extension as Exported UTIin my Info package Info.plist as follows:

<key>UTExportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeConformsTo</key>
        <array>
            <string>public.data</string>
            <string>public.archive</string>
            <string>com.rarlab.rar-archive</string>
        </array>
        <key>UTTypeDescription</key>
        <string>Custom RAR Archive</string>
        <key>UTTypeIdentifier</key>
        <string>com.my-company.rarx-archive</string>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>public.filename-extension</key>
            <array>
                <string>rarx</string>
            </array>
        </dict>
    </dict>
</array>

And I also import RAR UTI accordingly:

<key>UTImportedTypeDeclarations</key>
<array>
    <dict>
        <key>UTTypeConformsTo</key>
        <array>
            <string>public.data</string>
            <string>public.archive</string>
        </array>
        <key>UTTypeDescription</key>
        <string>RAR Archive</string>
        <key>UTTypeIconFile</key>
        <string>RAR</string>
        <key>UTTypeIdentifier</key>
        <string>com.rarlab.rar-archive</string>
        <key>UTTypeTagSpecification</key>
        <dict>
            <key>public.filename-extension</key>
            <array>
                <string>rar</string>
                <string>rarx</string>
            </array>
        </dict>
    </dict>
</array>

RARX files seem to never be associated with my application after launch. To check the association I used mdlsas follows:

mdls -name kMDItemContentTypeTree "/Users/Me/.../A File.rarx"
>>> kMDItemContentTypeTree = (
    "com.another-company.rarx-archive",
    "public.data",
    "public.item",
    "public.archive"
)

UTI (com.my-company.rarx-archive) ? , , Quick Look , com.another-company.rarx-archive UTI. - , . qlmanage .

+5
1

, UTI, Launch Services. com.rarlab.rar-archive rar com.rarlab.rar-archive, .

Exported, rar. Imported com.rarlab-rar-archive QuickLook, , .

QuickLook, . , , QuickLook UTI, , . , QuickLook , .

+1

All Articles