[futurebasic] Re: [FB] Drop file on icon

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2004 : Group Archive : Group : All Groups

From: John McKernon <misc@...>
Date: Mon, 19 Jan 2004 14:50:34 -0500
> However, the tenor of your reply credits me with far more osx/xml/plist
> knowledge and sophistication than I actually posses (which is a very
> long-winded way of saying I'm completely clueless)...
> 
>> You need to have your PLIST set up correctly.
> 
> What is the 'PLIST'? Where is the 'PLIST'?

Ah, there's the rub! A "PLIST" can be either in a file by itself which
accompanies your application by being "bundled" with it, or it can be a
traditional resource in the application's resource fork. I use the resource
method, in which case the resource type is "plst" (no "I").

In either case, you can make a plist using any text editor (I use BBEdit),
just type the text in a shown in Robert's post. Omit any file types you
don't need to handle, and adjust the words in the rest of it as needed.

> Your xml file below appears to refer to several image file types/format. I
> need only one: '.jpg'/ ostype = _"JPEG"

In your case, modify this section of Robert's example:

        <dict>
            <key>CFBundleTypeName</key>
                <string>JPEG file</string>
            <key>CFBundleTypeRole</key>
                <string>Editor</string>
            <key>CFBundleTypeIconFile</key>
                <string>145</string>
            <key>CFBundleTypeOSTypes</key>
                <array>
                    <string>JPEG</string>
                </array>
            <key>CFBundleTypeExtensions</key>
                <array>
                    <string>jpg</string>
                    <string>JPG</string>
                    <string>jpeg</string>
                    <string>JPEG</string>
                </array>
        </dict>

So it looks like this:

        <dict>
            <key>CFBundleTypeName</key>
                <string>JPEG file</string>
            <key>CFBundleTypeRole</key>
                <string>Editor</string>
            <key>CFBundleTypeIconFile</key>
                <string>145</string>
            <key>CFBundleTypeOSTypes</key>
                <array>
                    <string>JPEG</string>
                </array>
            <key>CFBundleTypeExtensions</key>
                <array>
                    <string>jpg</string>
                    <string>JPG</string>
                </array>
        </dict>

Because you don't handle the other file types, you can delete their entire
<dict> </dict> sections.

Just be sure you get the <key> </key> and <string> </string> and <dict>
</dict> things paired up evenly, just as if you were writing HTML.

To get the plist into the resource fork, I use Resourcerer - it's plst
resource #0. By simply including a plst resource, OSX will understand all it
needs to about icons and what file types your application can accept.

If you have the Apple Developer documentation & tools, there is an
application which generates almost-right plists, but I found there were some
subtleties that were missing in the Apple-generated version -- so look at
Robert's example and follow precisely, only changing (or removing) the file
types that you need or don't need. In particular, know that you need to
include both uppercase and lowercase versions of file extensions.

Maybe one of us should sit down and write an application to generate plists
for mortals...

- John

------------------
John McKernon
misc@...