UTIs and type codes and extensions
UTIs and type codes and extensions
- Subject: UTIs and type codes and extensions
- From: Randall Meadows <email@hidden>
- Date: Tue, 13 Jan 2009 18:14:28 -0700
I'm just making sure I'm not missing something...
There's no system-defined way to go from a UTI to an old-style file
type code (which the UTI docs seem to refer to as a "tag") and back
again, am I correct?
For instance, my app can export files as TIFF, JPEG, or PNG. When the
user makes the selection, I convert the selection popup menu to the
appropriate UTI using the defined constants in UTCoreTypes.h
(kUTTypeTIFF, et al). I'd like to generalize the subsequent code to
take that UTI ("public.tiff" for example) and convert it to the
appropriate type code ('TIFF'). The next logical step would be
producing a file name extension based on that as well ("public.tiff" -
> "tif").
*All* this information is contained in the table at <http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html#//apple_ref/doc/uid/TP40001319-CH205-CHDIJFGJ
>, but I could discern no way to actually do these types of
conversions in a general manner.
History: The reason I need to do this is, Photoshop is brain-dead when
it comes to opening image files that happen to have no extension in
the filename (and no file type code). Preview, QuickTime Player and
GraphicConverter (and sometimes Safari) have NO problem identifying
and opening the exact same files, sans extension, but PS simply says
"Could not complete your request because Photoshop does not recognize
this type of file." I am working around this by attaching type and
creator codes to all the image files I export. (Yes, my client could
avoid all this by simply including an extension to the image name, but
old dogs, new tricks, and all that...)
Thanks!
randy
_______________________________________________
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