I'm trying to find some way in Cocoa to translate from file extensions to Uniform Type Identifiers. That is, I want to find some way of doing this:
".jpg" => "public.jpeg"
".html" => "public.html"
".ttf"=> "public.truetype-font"
I've searched on the NSWorkspace docs but couldn't find anything. The closest I could get was:
- (NSImage *)iconForFileType:(NSString *)fileType
that returns the icon for a file extension, and
– (NSString *)preferredFilenameExtensionForType:(NSString *)typeName
that does exactly the opposite of what I'm trying to do. Do any of you know how to do this?
I really hope I don't have to check for a lot of extensions by hand.
Thanks in advance.
Create
in it, you're responsible forrelease
ing the object. – Kerrison