如何在mac osx上选择一个程序作为“打开方式”选项


2

我正在使用mac osx 10.7.5,我希望能够右键单击一个文件并选择打开...并在该菜单中显示图标,而不必选择“其他”并转到我的应用程序文件夹选择了该计划。我不希望这个程序成为默认程序(默认情况下应保持原样)。如何将程序添加到此上下文菜单?

Answers:


1

您可以在Info.plist中向CFBundleDocumentTypes数组添加条目,但它会被更新覆盖。如果应用程序已签名,它也会破坏代码签名,而某些应用程序(如TextEdit和Chess)将在启动时崩溃。

<dict>
    <key>CFBundleTypeExtensions</key>
    <array>
        <string>txt</string>
    </array>
</dict>

要注册更改,请运行/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f /Applications/SomeApp.app/killall Finder


2
无需lsregister手动运行,只需触摸应用程序包(touch /Applications/SomeApp.app),然后在Finder中取消选择并重新选择应用程序。更新的mod日期将强制Finder重新检查Info.plist并自动重新注册应用程序。
NSGod 2013年

我最终用你的方法解决了它,NSGod
mheavers 2013年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.