Results 1 to 3 of 3
  1. #1
    Info.plist to *open* a file

    Member Since
    Mar 22, 2009
    Posts
    6
    Info.plist to *open* a file
    Hi all,

    I do some development for an open source project called KeePassX (www.keepassx.org), which is built on top of the Qt platform. Up until recently we just let it automatically generate the Info.plist file but the file was insufficient so I have changed the profile (basically like a Makefile for Qt) and have it use an Info.plist file that I manually generated.

    This is a vast improvement and one really nice thing about it is that double-clicking on a file now launches KeePassX. Furthermore, the files associated with KeePassX (.kdb files) all have the proper icon on them as well.

    The problem is that double-clicking on a file only launches KeePassX, but it doesn't actually open the file once the application has launched. You still need to either press command+O or go to File -> Open database to actually get the program to open the file. Does this mean that I'm missing something from the Info.plist file?

    Certainly this behavior is undesirable. When I click on a file with the extension .doc it launches Microsoft Word and then opens the document. It would be silly for it to launch Word and then still have to go to File -> Open in order to open the document that I had just double-clicked on; yet this is how KeePassX is currently behaving.

    Below is the Info.plist file (taken from SVN revision 297 if you happen to checkout the code). Any ideas are appreciated as we are about to release version 0.4.0 and I was really hoping to have this fixed. Our Linux version now properly associates itself with .kdb files and it will properly open them when a database file is double-clicked. I would like to get the Mac release working as well. Thanks!

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
      <dict>
    
        <!-- For a full list of properties, see
        http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html
        -->
    
    
    
        <key>CFBundleIconFile</key>
        <string>icon.icns</string>
    
        <key>CFBundlePackageType</key>
        <string>APPL</string>
    
        <key>CFBundleGetInfoString</key>
        <string>KeePassX 0.4.0</string>
    
        <key>CFBundleSignature</key>
        <string>kpsx</string>
    
        <key>CFBundleExecutable</key>
        <string>KeePassX</string>
    
        <key>CFBundleVersion</key>
        <string>0.4.0</string>
    
        <key>CFBundleShortVersionString</key>
        <string>0.4.0</string>
    
        <key>CFBundleName</key>
        <string>KeePassX</string>
    
        <key>CFBundleInfoDictionaryVersion</key>
        <string>6.0</string>
    
        <key>CFBundleIdentifier</key>
        <string>com.apple.application-bundle</string>
    
        <key>CFBundleDocumentTypes</key>
        <array>
          <dict>
            <key>CFBundleTypeExtensions</key>
              <array>
                <string>kdb</string>
              </array>
            <key>CFBundleTypeIconFile</key>
            <string>icon</string>
            <key>CFBundleTypeName</key>
            <string>KeePassX Password Database</string>
            <key>CFBundleTypeOSTypes</key>
               <array>
                 <string>kpsx</string>
               </array>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
          </dict>
        </array>
    
      </dict>
    </plist>


    Here is an update. I put some debug statements into the code and compiled it. If I launch the code from the command line by specifying the binary directly then it prints out the correct argument (and even correctly opens the application AND the file, like I would expect it to):

    Code:
    adamwest:keepassx bmayes$ /Applications/KeePassX.app/Contents/MacOS/KeePassX ~/Documents/Example.kdb 
    "/Users/bmayes/Documents/Example.kdb"
    However, if I use the open command from terminal it doesn't print anything and doesn't open the file -- it just opens the application and never opens the file:

    Code:
    adamwest:keepassx bmayes$ open ~/Documents/Example.kdb 
    adamwest:keepassx bmayes$
    I think this might have something to do with the fact that it's using the Cocoa framework and actually calling the application::openFile function instead of passing the name of the file as an argument to argv?

    NSApplication Class Reference

  2. #2
    Info.plist to *open* a file
    xstep's Avatar
    Member Since
    Jun 25, 2005
    Location
    On the road
    Posts
    3,231
    Specs:
    2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
    I haven't played with that so I Googled it found this at O'Reilly.

    There might also be the need to register the file extension with an application.
    This link discusses that. In fact this may be the better link of the two.
    CameraTime - Time lapse photography for novice and advanced users.

    When asking questions, post the version of your software. You'll receive better answers.

    Please post your results to the thread as it is good feedback.

  3. #3
    Info.plist to *open* a file

    Member Since
    Mar 22, 2009
    Posts
    6
    Nevermind, we were able to get it working without using the Info.plist file. Thanks for looking though.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Info.plist missing NSPrincipalClass
    By polyfrag in forum OS X - Development and Darwin
    Replies: 1
    Last Post: 07-30-2013, 05:22 AM
  2. OpenGLES info.plist deleted!
    By AweSomeColt in forum iOS and Apps
    Replies: 0
    Last Post: 11-12-2011, 02:20 PM
  3. Photo booth - Deleted info.plist
    By Crosis88 in forum OS X - Apps and Games
    Replies: 1
    Last Post: 10-22-2008, 02:40 PM
  4. TextEdit's Info.plist clobbered!
    By asokan in forum OS X - Operating System
    Replies: 0
    Last Post: 08-03-2008, 04:43 PM
  5. info.plist question
    By meskue in forum OS X - Operating System
    Replies: 2
    Last Post: 05-18-2006, 05:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •