简体   繁体   English

设置默认文件关联Mac OS X Java Package Maker安装程序

[英]Set Default file association Mac OS X Java Package Maker Installer

I have two questions about Package Maker on Leopard. 关于Leopard上的Package Maker,我有两个问题。 I installed Xcode 3.1.4. 我安装了Xcode 3.1.4。 I exported my Java app out of Eclipse into an app bundle and made an installation program for it. 我将Java应用程序从Eclipse导出到应用程序捆绑包中,并为此制作了一个安装程序。 I know little about Macs so I am going off of random sites right now on how to use this tool. 我对Mac知之甚少,所以现在我不打算使用随机工具来使用此工具。

1) Is there a way using Package Maker or alter the "Info.plist" to register a specific file extension to your app by default when it is installed? 1)有没有一种方法可以使用Package Maker或更改“ Info.plist”以在安装时默认将特定的文件扩展名注册到您的应用程序? Right now it gives the "There is no default application specified to open this document". 现在,它给出了“没有指定默认的应用程序来打开此文档”。

2) Where is the program installed to by default on the HD? 2)HD上默认将程序安装在哪里? I tried installing with the setting "User selected Volume" as well as "User home directory" and I cannot find my application anywhere. 我尝试使用设置“用户选择的卷”以及“用户主目录”进行安装,但我在任何地方都找不到我的应用程序。

The program said installed successfully but nothing is in the "/Applications" directory or the "/Users/Username/" directory. 该程序说安装成功,但是“ / Applications”目录或“ / Users / Username /”目录中没有任何内容。 I see the BOM in the "/Library/Reciepts/boms/" directory but there is no app folder with the app bundle. 我在“ / Library / Reciepts / boms /”目录中看到了BOM表,但是该应用程序包中没有应用程序文件夹。

UPDATE: This question is completed. 更新:此问题已完成。 Part 1 I posted my answer to below, and part 2 was answered by Nate. 第1部分将答案发布到下面,第2部分由Nate回答。

Maybe this thread can help regarding issue 2: 也许该线程可以对问题2有所帮助:

http://lists.apple.com/archives/installer-dev/2009/Sep/msg00036.html http://lists.apple.com/archives/installer-dev/2009/Sep/msg00036.html

Here is the answer to part 1 of my post above, and Part 2 was solved with the link from Nate in the other answer. 这是我上面的帖子的第1部分的答案,而第2部分是通过另一个答案中Nate的链接解决的。

To solve part one I altered the info.plist file of the application bundle. 为了解决第一部分,我更改了应用程序捆绑包的info.plist文件。 I only included the relevant parts of the plist file, and my specific file types were archive file (made up extensions). 我只包括了plist文件的相关部分,而我的特定文件类型是存档文件(由扩展名组成)。 Both keys were needed for it to register the types. 需要两个键来注册类型。

<key>CFBundleDocumentTypes</key>
        <array>
            <dict>
                    <key>CFBundleTypeExtensions</key>
                    <array>
                        <!-- Enter as "txt" for example, not ".txt" -->
                    <string>yourExtension1</string>
                        <string>yourExtension2</string>
                    </array>
                    <key>CFBundleTypeName</key>
                    <string>YourType document</string>
                    <key>CFBundleTypeRole</key>
                    <string>Viewer</string>

            <!-- The LSItemContentTypes key is ignored in Mac OS X v10.4 because it’s introduced in 10.5. -->
                    <key>LSItemContentTypes</key>
                    <array>
                        <string>public.archive</string>
                        <string>public.data</string>
                        <string>public.content</string>
                    </array>

                    <!-- The NSExportableTypes key is ignored in Mac OS X 10.4 -->
                    <key>NSExportableTypes</key>
                    <array>
                        <string>public.archive</string>
                        <string>public.data</string>
                        <string>public.content</string>
                    </array>

            <!-- The LSHandlerRank key is ignored in Mac OS X 10.4 -->
            <key>LSHandlerRank</key>
            <string>Owner</string>
            </dict>
         </array>

<key>UTExportedTypeDeclarations</key>
    <array>

        <dict>
            <key>UTTypeIdentifier</key>
            <string>public.archive</string>
            <key>UTTypeReferenceURL</key>
            <string>http://www.yourSite.com</string>
            <key>UTTypeDescription</key>
            <string>yourType Document</string>
            <key>UTTypeConformsTo</key>
            <array>
                <string>public.content</string>
                <string>public.data</string>
                <string>public.archive</string>
            </array>
            <key>UTTypeTagSpecification</key>
            <dict>
                <key>com.apple.ostype</key>
                <string>public.archive</string>
                <key>public.filename-extension</key>
                <array>
                    <string>yourExtension1</string>
                    <string>yourExtension2</string>
                </array>
            </dict>
        </dict>
    </array>

Also see my question for a bit more documentation and elaboration: 另请参阅我的问题以获取更多文档和详细说明:

Double click document file in Mac OS X to open Java application 双击Mac OS X中的文档文件以打开Java应用程序

I've also been using Spotlight to find and remove all old versions of my program for a cleaner testing environment. 我还一直在使用Spotlight查找和删除程序的所有旧版本,以提供更干净的测试环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM