Thread: Info.plist to *open* a file
03-22-2009, 01:26 AM #1
Info.plist to *open* a file
- Member Since
- Mar 22, 2009
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!
<?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):
adamwest:keepassx bmayes$ /Applications/KeePassX.app/Contents/MacOS/KeePassX ~/Documents/Example.kdb "/Users/bmayes/Documents/Example.kdb"
adamwest:keepassx bmayes$ open ~/Documents/Example.kdb adamwest:keepassx bmayes$
NSApplication Class Reference
03-22-2009, 02:58 PM #2
CameraTime - Time lapse photography for novice and advanced users.
- Member Since
- Jun 25, 2005
- On the road
- 2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
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.
03-23-2009, 12:00 AM #3
- Member Since
- Mar 22, 2009
Nevermind, we were able to get it working without using the Info.plist file. Thanks for looking though.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By polyfrag in forum OS X - Development and DarwinReplies: 1Last Post: 07-30-2013, 06:22 AM
By AweSomeColt in forum iOS and AppsReplies: 0Last Post: 11-12-2011, 03:20 PM
By Crosis88 in forum OS X - Apps and GamesReplies: 1Last Post: 10-22-2008, 03:40 PM
By asokan in forum OS X - Operating SystemReplies: 0Last Post: 08-03-2008, 05:43 PM
By meskue in forum OS X - Operating SystemReplies: 2Last Post: 05-18-2006, 06:16 PM