简体   繁体   中英

Set Default file association Mac OS X Java Package Maker Installer

I have two questions about Package Maker on Leopard. I installed Xcode 3.1.4. I exported my Java app out of Eclipse into an app bundle and made an installation program for it. I know little about Macs so I am going off of random sites right now on how to use this tool.

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? 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? 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. I see the BOM in the "/Library/Reciepts/boms/" directory but there is no app folder with the app bundle.

UPDATE: This question is completed. Part 1 I posted my answer to below, and part 2 was answered by Nate.

Maybe this thread can help regarding issue 2:

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.

To solve part one I altered the info.plist file of the application bundle. I only included the relevant parts of the plist file, and my specific file types were archive file (made up extensions). 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

I've also been using Spotlight to find and remove all old versions of my program for a cleaner testing environment.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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