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: launch services file association




On Jan 13, 2007, at 7:22 PM, Daniel Birns wrote:

Our application is associated with documents that have a .dart
suffix.  The problem is that that suffix is already used by Apple:
com.apple.disk-image-dart.

We can't really change it, because it's already in use on other
platforms.  And we like it.

Currently I'm overriding this default in a way that's working but
is kind of ugly.   I haven't encountered a .dart disk image before,
and it doesn't seem to be in much use, so I think overriding this
is fairly safe.

Here's how I'm doing it:

{ defaults read com.apple.LaunchServices 2>&1 | grep
dartdevices.dartplayer  > /dev/null
} || {
defaults write com.apple.LaunchServices LSHandlers -array-add
'<dict><key>LSHandlerContentType</key><string>com.apple.disk-image-
dart</string><key>LSHandlerRoleAll</
key><string>com.dartdevices.dartplayer</string></dict>'
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/
LaunchServices.framework/Support/lsregister -kill -r -domain local -
domain system -domain user
}

The defaults command is used first to ensure I don't do this twice.
Then, if it's not already set, I add a default for this user to use
our app instead of the Apple default.

Then I use lsregister to reset the users LaunchServices --
otherwise it doesn't seem to take.

Is all this safe? Is there a better way to do this?

This seems very heavy-handed to me. How do you have your plist entry set up for this? Do you use a file type for these?

I agree that it's heavy-handed, and I'd much prefer a different way. The plist file is setup via the XCode Target Properties. this works fine, except that the apple Disk Image takes priority. So if you double click on our document, it tries to open it as a Disk Image. You have to select Open With. This only comes up because we use a suffix that's already used by Apple.


Here's what's in the plist:

<key>CFBundleDocumentTypes</key>
	<array>
		<dict>
			<key>CFBundleTypeExtensions</key>
			<array>
				<string>dart</string>
			</array>
			<key>CFBundleTypeIconFile</key>
			<string>DartPlayer.icns</string>
			<key>CFBundleTypeName</key>
			<string>Dart</string>
			<key>CFBundleTypeOSTypes</key>
			<array>
				<string>dart</string>
			</array>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
			<key>LSTypeIsPackage</key>
			<false/>
			<key>NSPersistentStoreTypeKey</key>
			<string>XML</string>
		</dict>
	</array>

Have you tried adding:

			<key>LSIsAppleDefaultForType</key>
			<true/>

Larry

PS: Please don't take threads private. It excludes smart people from the discussion. ;-)

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

This email sent to 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.