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: Get a list of all Apps for a File



The missing apps don't have an Info.plist claim for opening the public.jpeg document type. They claim the extension (jpg or jpeg) but not the UTI.

This invocation:

UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef) @"jpg", NULL)

returns string public.jpeg. Passing that string to LSCopyAllRoleHandlersForContentType returns the list of apps that claim to handle open files with type public.jpeg. If you look at the Info.plist claims for ColorSyncUtility, Preview, and CoreImageFunHouse, you'll see those apps have adopted UTI-based document claims (using key LSItemContentTypes).

-Chris


On May 8, 2008, at 1:24 PM, Daniel Dalquen wrote:

Hi,

I need to get a list of all applications that can open a specific file (type). I found the two functions LSCopyApplicationURLsForURL() and LSCopyAllRoleHandlersForContentType(). I would like to know what the difference is between the two - why doesn't one return the same apps as the other?

E.g. for an image file, say JPEG:

LSCopyApplicationURLsForURL(fileURL, kLSRolesViewer | kLSRolesEditor);

returns an array with the following Apps:
/Applications/Firefox.app, /Applications/Safari.app, /Applications/Utilities/ColorSync Utility.app, /Applications/Preview.app, /Applications/TextWrangler.app, /Applications/QuickTime Player.app, /Developer/Applications/Graphics Tools/Core Image Fun House.app, /Developer/Applications/Xcode.app, /Applications/RealPlayer.app, /Applications/img2icns.app, /Applications/Opera.app, /Applications/GraphicConverter.app, /Applications/BBEdit.app

whereas calling

LSCopyAllRoleHandlersForContentType(UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (CFStringRef) @"jpg", NULL), kLSRolesViewer | kLSRolesEditor);

returns only the following identifiers:
com.apple.ColorSyncUtility, com.apple.Preview, com.apple.CoreImageFunHouse.app

How come, all the other apps are missing? Is there a way around it other than creating a fake file with a given extension and then calling LSCopyApplicationURLsForURL()?

Cheers,
Daniel
_______________________________________________
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

 _______________________________________________
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

References: 
 >Get a list of all Apps for a File (From: Daniel Dalquen <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.