Re: What REALLY determines which application opens a file?
Re: What REALLY determines which application opens a file?
- Subject: Re: What REALLY determines which application opens a file?
- From: Quincey Morris <email@hidden>
- Date: Tue, 7 Sep 2010 22:30:29 -0700
On Sep 7, 2010, at 21:46, G S wrote:
> I didn't have any entry in the "Document Types" list in the target's
> properties. The documentation didn't mention (let alone explain) the
> relationship between this list and the UTI collection in the plist. I
> still don't see why you'd have both.
The information in the plist is intended to describe application-defined UTIs that are different from any of the system supplied UTIs, *and/or* (AFAIK) mappings from metadata (extensions and file types) that are different from the system supplied mappings even if the UTIs are already known. This information doesn't tell Launch Services what kinds of files the application can open, just (in some sense) what kinds of files the application is aware of or wants to make other applications aware of.
The document types describe the kinds of files an application can actually open. Each can contain UTIs and/or extensions and/or HFS file types (plus other stuff like MIME types that I'm ignoring). Although all of these things can be specified for the document type, only one of them is used in any given case (AFAIK). I don't know what the rule is, but my guess is that it's:
1. If the document type has a UTI that matches a candidate file's UTI, the document type is used to open the file. Otherwise ...
2. If the document type has a HFS file type and the candidate file has a matching HFS file type, the document type is used to open the file. Otherwise ...
3. If the document type has an extension that matches the candidate file's extension, the document type is used to open the file.
The key point here is that in case (1), the candidate file's UTI may be known for any of these reasons (AFAIK):
a. It's one of the standard ones, so knowing it doesn't depend on your application's plist UTI declarations, if any.
b. It's been defined to Launch Services by some other application's plist UTI declarations, so knowing it doesn't depend on your application's plist UTI declarations, if any.
c. It's been defined to Launch Services by your application's plist UTI declarations.
Other than standard UTIs, the most common case is (c). In that case, the plist does look like it contains duplicate information, but really it's just a special case of a more general mechanism where the UTI declarations and the document type declarations are independent.
HTH
_______________________________________________
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