On 3, Jan, 2012, at 07:14 PM, Quincey Morris wrote:

> On Jan 3, 2012, at 02:11 , Martin Hewitson wrote:
> 
>> Actually, it seems that the NSWorkspace method behaves differently, 
>> (assuming I'm using it correctly):
>> 
>> [[NSWorkspace sharedWorkspace] filenameExtension:@"pdf" 
>> isValidForType:(NSString *)kUTTypeText]
>> 
>> returns YES
>> 
>> whereas the UTTypeConformsTo() solution returns NO.
> 
> One thing to consider is that your UTType… approach uses the *preferred* UTI 
> for '.pdf', which may indeed not conform to the text type. But there could be 
> another '.pdf'-based UTI defined on your system that does conform. AFAICT the 
> standard UTIs don't contain a text-conforming UTI for '.pdf', but it's 
> certainly possibly that some app has added the association.
> 
> 

I see. I don't know how to check that. In any case, I'm left wondering which 
one to use. I want that .pdf is not a text file, so I guess I'll stick with the 
UTTypeConformsTo() solution, though this all feels a little fragile. I may make 
hard-coded exceptions for typical extensions that the app deals with, and 
always return YES from my -isText method for these particular extensions.

Thanks for your thoughts,

Martin

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
    Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: [email protected]
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





_______________________________________________

Cocoa-dev mailing list ([email protected])

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to