Re: Plain Text UTI Madness
Re: Plain Text UTI Madness
- Subject: Re: Plain Text UTI Madness
- From: "Sean McBride" <email@hidden>
- Date: Wed, 28 Jan 2009 21:34:42 -0500
Seth Willits (email@hidden) on 2009-01-28 8:56 PM said:
>I'm trying to get this NSOpenPanel to select all plain text files.
>This should be *simple* right? Sheesh. So I thought I'd use a UTI (in
>addition to some specific extensions and the HFS type 'TEXT'), so I
>added kUTTypePlainText. That really should be just dandy for my needs.
>
>Except it's not.
>
>I have a file without an extension, which in Finder is shown as "Plain
>text", has kMDItemKind = "Plain text", and yet kMDItemContentType is
>"public.data" -- what gives? Why is it a plain text "kind" of file,
>but not public.plain-text?
Does this extension-less file have an HFS type?
If not, UTIs won't help you. The OS currently derives a file's UTI by
examining:
a) its extension
b) its HFS type
c) its MIME type
Note the HFS creator is not consulted, nor is the file's contents.
So if you have no extension and no HFS type, I dunno which UTI you'll
get. Probably public.data, from what you say.
"Plain Text" seems to be the Finder's catch all. Try this: 'touch /
foo', then Get Info on that file. It's "Plain Text".
Sean
_______________________________________________
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