• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Plain Text UTI Madness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plain Text UTI Madness


  • Subject: Re: Plain Text UTI Madness
  • From: "Sean McBride" <email@hidden>
  • Date: Thu, 29 Jan 2009 18:05:57 -0500
  • Organization: Rogue Research Inc.

On 1/29/09 4:48 PM, Gregory Weston said:

>>>>> 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?
>>>
>>> Nope. It has no extension or HFS type. Which makes me totally
>>> understand why the UTI says it's plain.data
>>
>> Note also that the system always prioritizes extension over HFS type.
>
>Except when it doesn't. Assuming the documentation for Launch Services
>is correct, things are bit more complex than that.
>
>Consider the explanation here for determining the preferred app for a
>document.
>
><http://developer.apple.com/documentation/Carbon/Conceptual/
>LaunchServicesConcepts/LSCConcepts/chapter_2_section_8.html
> >
>
>If extension is given priority over type code in this process, it's an
>implementation detail that's explicitly not guaranteed.

I should have been clearer.  Let me restate: the system always
prioritizes extension over HFS type _when deciding the UTI for a file_.
Deciding which app will open a document depends on the UTI but also the
creator code, and other things, as you said.

Try this:

$ touch /foo.img
$ SetFile -t 'JPEG' /foo.img
$ mdls -name kMDItemContentType /foo.img

it says:

kMDItemContentType = "com.apple.disk-image-ndif"

This makes it very difficult to deal with conflicting extensions.  You
can't even work around the conflict by using an HFS type.

(Also, note that the document you link to predates the release of 10.5,
though it could be there were no relevant changes.)

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada


_______________________________________________

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

References: 
 >Re: Plain Text UTI Madness (From: Gregory Weston <email@hidden>)

  • Prev by Date: re: Core data storage of objects whose class is loaded from a bundle
  • Next by Date: Re: NSTask Leaking...
  • Previous by thread: Re: Plain Text UTI Madness
  • Next by thread: Setting cocoa application in system menu bar.
  • Index(es):
    • Date
    • Thread