开发者

Testing if an application can open a specific type?

开发者 https://www.devze.com 2022-12-18 01:43 出处:网络
On Mac OS X,开发者_如何学Python how can I tell if a given application opens a specific type? I have two UTIs that I\'m interested in: public.text and public.image and I have a list of applications. I

On Mac OS X,开发者_如何学Python how can I tell if a given application opens a specific type?

I have two UTIs that I'm interested in: public.text and public.image and I have a list of applications. I want to filter the list by those two types so I have a list of text viewers and a list of image viewers.

I've seen a related question on SO where it's possible to get a list of all the viewers for a particular document type. I could do that and get the intersection of the set, but I'd rather be able to ask each application individually.

Are there any Cocoa or Carbon calls for that?


If you want a list of applications for a given document type, use LSCopyAllRoleHandlersForContentType.

If you want a list of document types for a specific application, open the application's Info.plist file and read the CFBundleDocumentTypes key.


Launch Services is your friend. But I don't think there's any API which gets the UTIs supported by a given app, so I would suggest you to use what you already described, unfortunately.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号