开发者

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?

开发者 https://www.devze.com 2023-04-04 11:59 出处:网络
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 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:

  1. 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.
  2. 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.
  3. Do as e.g. Unison (a Mac OS X application) does a开发者_如何学运维nd ignore UTI entirely, and use CFBundleTypeExtensions in my Info.plist file. This seems wrong too, because not only is CFBundleTypeExtensions deprecated per Apple's documentation, but I don't think I can mix use of CFBundleTypeExtensions and LSBundleContentTypes (if LSBundleContentTypes is present, as it must be for me to use the com.bittorrent.torrent UTI, then CFBundleTypeExtensions 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.

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?

0

精彩评论

暂无评论...
验证码 换一张
取 消