Changing Default Viewer, UTIs, and File Extensions
Changing Default Viewer, UTIs, and File Extensions
- Subject: Changing Default Viewer, UTIs, and File Extensions
- From: "Marc Wan" <email@hidden>
- Date: Thu, 28 Sep 2006 17:15:49 +0800
Hello!
So, I appear to be going in a complete circle here, and every time I think
I have found another piece of the puzzle, I just end up yet one more
missing-piece-of-data away from the solution.
I want to offer to set my application as the default viewer for most image
types. So, I use [NSBitmapImageRep imageFileTypes] to get a list of image
extensions supported by the NSBitmapImageRep class. (The app already
declares itself as one possible viewer for these typess in its Info.plistfile).
The problem is, the only way I can figure out to SET a default viewer is
to call the
LSSetDefaultRoleHandlerForContentType
function. This function wants a UTI for the file. Now, I have two
problems:
1. how do i get the UTI from a file extension, such as that returned by
NSBitmapImageRep's imageFileTypes?
2. anybody have any ideas as to why some of the UTIs don't work? For
example, any time I call LSSetDefaultRoleHandlerForContentType with "
com.compuserve.gif", which the Apple docs claims is an official system UTI (
http://tinyurl.com/m96hq), it fails and says bad argument. Others, such as
"public.jpeg" work fine.
Any ideas? I'm losing some hair here on this one. Is there a better way
to mark myself as the default viewer for a particular file extension? I've
seen some functions that work with the old four character file type codes,
but that's just another can of worms ....
Thanks,
marc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden