Content types processable by an application
Content types processable by an application
- Subject: Content types processable by an application
- From: Dave DeLong <email@hidden>
- Date: Sat, 30 Oct 2010 17:16:53 -0600
Hi everyone,
Given an application path (or NSBundle to an application, etc), is there a way to easily/efficiently determine what content types that application can open?
My initial attempt was to read the applications Info.plist file and extract the content types listed under the kUTExportedTypeDeclarationsKey key. However, there are some flaws with this approach which I haven't been able to work around.
1. Not all applications use this key. For example, BBEdit does not, but instead lists a whole bunch of recognized file extensions.
2. UTIs are case-sensitive. Pages, for example, lists "com.apple.iWork.Pages.pages" as an exported content type, yet no Pages document actually has that type listed in its content type tree. Documents use "com.apple.iwork.pages.pages", which is defined by the iWork quicklook generator (at /Library/QuickLook/iWork.qlgenerator).
In know that with some of the LaunchServices functions (LSCopyApplicationURLsForURL(), LSCopyApplicationForMIMEType(), etc), I can get the applications that can open a file (or a file type), but I'd like to do the inverse. (Perhaps I'll have to resort to parsing the output of `lsregister -dump`?)
Essentially, what I'm trying to do is show a list of applications, and then for each application, show a list of files that that application can open (at least as a Reader, not necessarily as an Editor). Both of these lists are retrieved by Spotlight (NSMetadataQuery).
Any suggestions?
Thanks,
Dave
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden