On Nov 4, 2007, at 11:11 AM, Christiaan Hofman wrote: > The Leopard release notes about UTIs keep confusing me immensely. > IMHO they are either wrong, or the implementation is buggy. > > There is a -[NSDocument fileNameExtensionsForType:saveOperation:] > replacing [NSDocumentController fileExtensionForType:]. However it is > said to be only called from autosave and applescript save. So how is > the file extension for saving (exporting) actually determined? They > say it is determined by the save panel, but the save panel has no > information about this AFAICS.
It says it's specified by the user via the save panel, which isn't quite the same thing. I don't recall how the present export works...NSDocument/NSDocumentController is now a complete mess, in my opinion. > In Tiger fileExtensionForType: *is* > used for this, so what happens in Leopard? If we ever want to support > UTIs in Leopard this is crucial for custom templates. I added some support last year for opening, but we've overriden/used too many deprecated methods for it to work cleanly. My conclusion was that it's not worthwhile for us to try and support UTIs unless we ditch Tiger support, or we'll end up with the same un-debuggable mess we had with different save paths on Panther and Tiger. The worst part is that some deprecated methods are still called on 10.5, but you have to work with a mix of UTI and old types. > -[NSDocumentController documentClassForType:] returns the first > document class that has a readable UTI to which the passed in type > conforms (for UTIs). That sounds pretty buggy to me. If I have, say, > a document class handling kUTTypeText, and another one handling a > custom type that conforms to kUTTypeText, then according to this rule > *both* document classes could read the custom type. So this methods > returns either one of the document classes, and in fact an arbitrary > one. That is obviously wrong, as it should return the class that can > handle the custom type. Is it really this buggy, or are the releae > notes wrong? I think that's a good question for cocoa-dev. Maybe Ali Ozer could answer it; I have no idea. > Another thing, what to do with known types (e.g. having a MIME type) > for which there isn't a UTI? The MIME type key in Info.plist have never been used, according to the Leopard docs. You can specify a MIME type as part of a UTI specification, though, as we do for RIS/ISI. > As Leopard wants all or nothing (all > have a UTI or none have a UTI) it gives a big problem. You can choose > some custom UTI, but then two apps declaring this type will give > conflicts (in particular because NSDocumentController now uses the > shared NSWorkSpace to interpret UTIs from URLs, rather than keeping > it within the app). On the other hand, not using a UTI is not allowed > when you want to use UTIs for other types. UTI support is all or nothing, which sucks for us. If we had a few proprietary binary formats, this would likely be great. > It seems to me, looking at the release notes, that it is impossible > to handle custom template types using UTIs in Leopard. I don't know that it's impossible, but it's certainly unpleasant and would definitely require a lot of work and testing for no gain. I like UTIs and I hate the mix of document type/file extension that's used in 10.4 and earlier, but I'd rather have just seen a new document class altogether. -- adam ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Bibdesk-develop mailing list Bibdesk-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-develop