Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Override a UTI?



A lot of applications out there are not yet UTI based and still rely on "old" application Info.plist contents (the type is defined at the same time as the application's role for this type).

For example, look at iChat's Info.plist:

	<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeExtensions</key>
			<array>
				<string>ichat</string>
				<string>chat</string>
			</array>
			<key>CFBundleTypeIconFile</key>
			<string>savedChatFile</string>
			<key>CFBundleTypeName</key>
			<string>Chat transcript</string>
			<key>CFBundleTypeOSTypes</key>
			<array>
				<string>chat</string>
			</array>
			<key>CFBundleTypeRole</key>
			<string>Viewer</string>
			<key>NSDocumentClass</key>
			<string>ChatDoc</string>
		</dict>
        </array>

As defining a type should be independent of its application, the new approach is:
1) define tags -> type mapping
2) define type -> role mapping


So, the Info.plist "new-style" should look like:

<!-- application defines what types it handles and how -->
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.ichat.transcript</string>
</array>
<key>NSDocumentClass</key>
<string>ChatDoc</string>
</dict>
</array>
<!-- application, or someone else, defines what com.apple.ichat.transcript is -->
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeIdentifier</key>
<string>com.apple.ichat.transcript</string>
<!-- what it is -->
<key>UTTypeConformsTo</key>
<array>
<string>public.message</string>
<string>public.data</string>
</array>
<key>UTTypeDescription</key>
<string>Chat transcript</string>
<key>UTTypeIconFile</key>
<string>savedChatFile.icns</string>
<!-- how it is recognized -->
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>ichat</string>
<string>chat</string>
</array>
<key>com.apple.ostype</key>
<array>
<string>chat</string>
</array>
</dict>
</dict>
</array>


For the new kind of bundles (e.g. Spotlight importer and Quick Look generators), this approach is mandatory.
The fact that LS might be less "efficient" at mapping tags to types than mapping tags to applications should be considered a bug (or a feature).


--
Julien

On 16 févr. 08, at 02:59, Matt Hoffman wrote:

Yes, they have an HFS creator and type. I realize the finder is using that to display the icon and decide
which application to launch. I guess my question is: Does the Finder also use UTIs via LaunchServices
for this purpose? If so, it seems to have a more graceful way of dealing with multiple UTIs with the same
extensions since it is looking at both the Type and UTI.


On Feb 15, 2008, at 4:35 PM, Sean McBride wrote:

On 2/15/08 3:11 PM, Matt Hoffman said:

I realize it is slightly off topic, but why doesn't the Finder have
this problem? It shows my icons properly and launches the correct app
when I double-click on one of my .img files. Does the Finder not use
LaunchServices?

Do your files have an HFS creator? The creator does not influence the
UTI, but does influence the icon the Finder uses, and the app it
launches with, I believe.


--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quicklook-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicklook-dev/jjalon %40apple.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Quicklook-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quicklook-dev/email@hidden

This email sent to email@hidden
References: 
 >Override a UTI? (From: Matt Hoffman <email@hidden>)
 >Re: Override a UTI? (From: Matt Hoffman <email@hidden>)
 >Re: Override a UTI? (From: Julien Jalon <email@hidden>)
 >Re: Override a UTI? (From: Matt Hoffman <email@hidden>)
 >Re: Override a UTI? (From: Julien Jalon <email@hidden>)
 >Re: Override a UTI? (From: Matt Hoffman <email@hidden>)
 >Re: Override a UTI? (From: "Sean McBride" <email@hidden>)
 >Re: Override a UTI? (From: Matt Hoffman <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.