UTIs and document types in Leopard

Christiaan Hofman cmhofman at gmail.com
Sun Nov 11 15:15:34 PST 2007


Dear list,

Leopard seems to have moved from custom document type names to UTIs.  
Unfortunately this is an all or nothing approach, which often leads  
to a "nothing" approach. Reading the Leopard release notes I'm really  
confused though how UTIs should be used as document types.

One problem I can't find an answer to is how to handle standard file  
types for which no UTI exists. There are of course a lot of those  
around in the big bad world. If I want to use UTIs in my app (in some  
document types) I seem to be forced to declare a UTI for such a type.  
However just declaring  UTI of my own seems wrong as I don't "own"  
the file type. It seems to me worse than fragile. If some other app  
would do the same and declare its own custom UTI for this file type,  
NSWorkSpace could just as well return that UTI instead of my UTI,  
which would break my app. This is aggravated by the fact that in  
Leopard NSWorkSpace is used to identify the UTI from the URL instead  
of NSDocumentController.

Another problem is: how does the Save panel / document determine the  
file extension for a saved type? In Tiger [NSDocumentController  
fileExtensionsForType:] was used. But in Leopard this method is  
depreated, and it's replacement in NSDocument is not used for this  
situation according to the docs. So am I forced to declare all UTIs  
for all document types I'd like to save? Then my question is: how can  
I declare UTIs, apart from in Info.plist? We have an app that can  
define document types for saving at run time, so these cannot be  
defined in Info.plist. So how does NSDocumentController register UTIs  
with the system?

It seems to me that Leopard really has limited my possibilities and  
made things more fragile, rather than solving problems. That seems  
too bad.

Christiaan



More information about the MacOSX-dev mailing list