如何将 4 字符 OSType / NSFileHFSTypeCode 与特定 UTI 关联
我正在编写一个 MacFuse 插件,并且希望 finder 使用适当的图标和图标。打开文件时启动相应的应用程序。
我无法向文件添加扩展名,因此 Snow Leopard 中唯一的其他选项是 NSFileHFSTypeCode。我已使用 http://www.rubicode.com/Software 查看了我的计算机上注册的所有代码/RCDefaultApp/ 我可以看到一些代码与 UTI 相关。例如,'TEXT'
与统一类型标识符 (UTI) com.apple.traditional-mac-plain-text
相关联。
我希望能够将其中一些 4 字符代码与其他 UTI 关联起来。例如 PHPf
到 public.php-script
。我想有某种框架或命令行实用程序可以让我做到这一点,但我还没有找到它。
I am writing a MacFuse plugin, and would like finder to use the appropriate icons & launch the appropriate app when a file is opened.
It is not possible for me to add an extension to the file, so my only other option in Snow Leopard is the NSFileHFSTypeCode. I have reviewed all of the codes registered on my machine using http://www.rubicode.com/Software/RCDefaultApp/ and I can see that some of the codes are associated with UTIs. For example 'TEXT'
is associated with the uniform type identifier (UTI) com.apple.traditional-mac-plain-text
.
I would like to be able to associate some of these 4-char codes with other UTIs. For example PHPf
to public.php-script
. I imagine that there's some kind of framework or command line utility that would allow me to do this, but I have not been able to find it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要在捆绑包的 Info.plist 中声明 UTI。如果是您自己的尿路感染,请将其导出;如果是别人的,就导入。
有关详细信息,请参阅UTI 文档。
You need to declare the UTI in your bundle's Info.plist. If it's your own UTI, export it; if it's someone else's, import it.
See the UTI docs for more information.