我需要以没有预定义 UTI 的格式打开文件,但我不拥有该格式。我应该如何导出UTI?
一般问题:当我不拥有特定的文件格式,但其他人没有为其定义 UTI 时,我该如何使用该文件格式?
具体情况:我正在为 .torrent 和 .nzb 文件创建一个 QuickLook 插件。 (注意:.nzb 文件与 .torrent 文件类似,只不过它们不是指向 BitTorrent 跟踪器,而是指向 Usenet 服务器。)我希望插件显示 .nzb/.torrent 文件指向哪些数据、哪些文件如果它们被打开,将会被下载,以及任何其他适用的元数据。为此,我必须阐明 这两种文件类型的统一类型标识符。虽然 .torrent 文件具有 com.bittorrent.torrent 的指定 UTI,但 .nzb 文件没有 - NZB 格式为 由 newzbin.com 定义,它不发布自己的应用程序(因此没有定义 Mac OS X 统一类型标识符供我使用)。
选项似乎是:
- 以 com.example.nzb 的形式导出并使用 UTI,其中 example.com 归我所有。这似乎是错误的,因为我不拥有 nzb 格式。
- 以 com.newzbin.nzb 的形式导出并使用 UTI,其中 newzbin.com 不属于我所有。这似乎是错误的,因为我不拥有 newzbin.com。
- 像 Unison (Mac OS X 应用程序)一样,完全忽略 UTI,并使用
我的
。这似乎也是错误的,因为不仅 苹果的文档,但我认为我不能混合使用Info.plist
文件中的 CFBundleTypeExtensionsCFBundleTypeExtensions
和LSBundleContentTypes
(如果LSBundleContentTypes
存在,因为它必须如果我使用 com.bittorrent.torrent UTI,则 CFBundleTypeExtensions 会被忽略)。
在这种情况下,正确的做法是什么?
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 and 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
mdls
命令行实用程序查找 .nzb 文件的 UTI。例如,在此 QuickTime 影片上执行
mdls
可以清楚地显示其 UTI,如下图红色框所示。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.