Under 10.5, I'm trying to switch over to using UTI's but am seeing
some weird results:

Given a pathName: if I call NSWorkspaces' typeOfFile:pathName
error:&error, it returns the proper type (com.apple.rtfd) for an RTFD
document.

But when I then create an NSURL of the path and pass that URL to
NSDocumentController's openDocumentWithContentsOfURL, it determines
the document type to be MSWORD which fails because it tries using
initWithDocFormat to load the document.

The RTFD document was created in TextEdit. I have an MSWORD type in my
CFBundleDocumentTypes, but there is no LSItemContentTypes defined for
it. Here are the two entries for these types.

Is there a reason why openDocumentWithContentsOfURL would somehow
override the type when compared with NSWorkspaces' typeOfFile? I'm
trying to understand what it is doing so I can take the right measures
to correct it.

                <dict>
                        <key>CFBundleTypeExtensions</key>
                        <array>
                                <string>rtfd</string>
                        </array>
                        <key>CFBundleTypeIconFile</key>
                        <string>rtfd.icns</string>
                        <key>CFBundleTypeName</key>
                        <string>RTFD</string>
                        <key>CFBundleTypeOSTypes</key>
                        <array>
                                <string>RTFD</string>
                        </array>
                        <key>CFBundleTypeRole</key>
                        <string>Editor</string>
                        <key>LSItemContentTypes</key>
                        <array>
                                <string>com.apple.rtfd</string>
                        </array>
                        <key>LSTypeIsPackage</key>
                        <true/>
                        <key>NSDocumentClass</key>
                        <string>RTFDocument</string>
                        <key>NSPersistentStoreTypeKey</key>
                        <string>Binary</string>
                </dict>

                <dict>
                        <key>CFBundleTypeExtensions</key>
                        <array>
                                <string>doc</string>
                        </array>
                        <key>CFBundleTypeName</key>
                        <string>MSWORD</string>
                        <key>CFBundleTypeOSTypes</key>
                        <array>
                                <string>W8BN</string>
                                <string>W6BN</string>
                        </array>
                        <key>CFBundleTypeRole</key>
                        <string>Viewer</string>
                        <key>NSDocumentClass</key>
                        <string>RTFDocument</string>
                </dict>


Thanks.

-- 
Mark Munz
unmarked software
http://www.unmarked.com/
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to