I need to open files in a format which has no predefined UTI, but I don't own the format. How should I export the UTI?
The general question: when I don't own a particular file format, but no UTI has been defined for it by someone else, how do I use that file format?
The specific situation: I'm creating a QuickLook plugin for .torrent and .nzb files. (Note: .nzb files are similar to .torrent files, except instead of pointing to a bittorrent tracker, they point to a Usenet server.) I want the plugin to display what data the .nzb/.torrent file points to, what files would be downloaded if they were opened, and any other applicable metadata. To do this, I have to set forth the Uniform Type Identifiers for these two filetypes. While .torrent files have a designated UTI of com.bittorrent.torrent, .nzb files do not - the NZB format is defined by newzbin.com, which doesn't publish its own application (and therefore doesn't define a Mac OS X Uniform Type Identifier for me to use).
The options seem to be:
- Export and use a UTI in the form of com.example.nzb, where example.com is owned by me. This seems wrong, because I don't own the nzb format.
- Export and use a UTI in the form of com.newzbin.nzb, where newzbin.com is not owned by me. This seems wrong, because I don't own newzbin.com.
- Do as e.g. Unison (a Mac OS X application) does a开发者_如何学运维nd ignore UTI entirely, and use
CFBundleTypeExtensions
in myInfo.plist
file. This seems wrong too, because not only isCFBundleTypeExtensions
deprecated per Apple's documentation, but I don't think I can mix use ofCFBundleTypeExtensions
andLSBundleContentTypes
(ifLSBundleContentTypes
is present, as it must be for me to use the com.bittorrent.torrent UTI, thenCFBundleTypeExtensions
is ignored).
What's the right thing to do in this situation?
Try using the mdls
command line utility to find a .nzb file's UTI.
For example performing mdls
on this QuickTime movie clearly shows its UTI, boxed in red below.
精彩评论