[Drawkit] File format extensions

Brad Larson larson at sonoplot.com
Wed May 21 07:55:19 PDT 2008


I've been testing this against the 10.5 SDK, and if you leave the UTI  
field out if the Info.plist, the typeName handed to the method is the  
name of the type, not a UTI.  When I specify a UTI, it won't even drop  
into the readFromData:ofType:error: method, it just says that the  
application cannot handle that type.  I've started reading through the  
documentation on UTIs, but it's giving me a headache.

I found a discussion of this here: http://www.mail-archive.com/bibdesk-develop@lists.sourceforge.net/msg00319.html 
  .  A relevant quote is

"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."

I know UTIs are supposed to be the future, but it seems so much easier  
to just use the document type names.

On May 21, 2008, at 2:31 AM, Graham Cox wrote:

> I think there will be a problem with this. If you link against the  
> 10.5 SDK (currently I don't recommend this, but soon this needs to  
> be addressed, so that people can use 10.5 features if they want to  
> extend DK) the <typeName> will be a UTI. A UTI typically contains  
> dots, so you'll end up with a method name like  
> 'dataFornet.apptree.drawing' which is not a valid Obj-C method name.
>
> An easy workaround would be to remove the dots or replace them with  
> underscores or another character.
>
> But the other, more difficult, problem is that <typeName> is going  
> to be different on 10.4 and 10.5. On 10.4 it's the type name  
> specified by your info.plist, on 10.5 it's the UTI. I'm only just  
> trying to make sense of UTIs and how these affect file opening and  
> saving so I'm not sure the best way to resolve this. You might  
> prefer to pass the typeName to another function that returns the  
> function name, so that it can be overridden, and possibly consider  
> making that work using a look-up table (dictionary) so that multiple  
> typeNames can be mapped to the same function. Or you might have a  
> better idea!
>
> I thought I'd better let you know since I want to make sure that DK  
> is UTI-savvy and can be built against the 10.5 SDK.
>
>
>
> On 16 May 2008, at 9:43 am, Brad Larson wrote:
>
>> - (NSData *)			dataOfType:(NSString*) typeName error:(NSError**)  
>> outError
>> {
>> 	NSString *nameOfFiletypeSavingMethod = [NSString  
>> stringWithFormat:@"dataFor%@", typeName];
>
> _______________________________________________
> Drawkit mailing list
> Drawkit at lists.apptree.net
> http://lists.apptree.net/listinfo.cgi/drawkit-apptree.net

______________________
Brad Larson
SonoPlot, Inc.
3030 Laura Lane, Suite 120
Middleton, WI 53562





More information about the Drawkit mailing list