Hello everyone,

I'm porting an Application from 10.4 to 10.5 at 64 bit, and I have a problem with resource files,
in the Tiger app I have this code to read some resource files:

FSSpec spec;
FSRef ref;
CFURLRef url = (CFURLRef)[NSURL fileURLWithPath: myPathString];
if (CFURLGetFSRef(url, &ref))
{
OSStatus result = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL, &spec, NULL);
        if (result == noErr)
        {
                SInt16 refNum = FSpOpenResFile(&spec, fsRdPerm);
                // do stuff....
        }
}


that works fine, but now in Leopard, FSSpec is deprecated as well as FSpOpenResFile, the docs say
to use FSOpenResourceFile instead, so I tried this:

ResFileRefNum ref;
FSRef fileRef;
CFURLRef url = (CFURLRef)[NSURL fileURLWithPath: myPathString];
if (CFURLGetFSRef(url, &fileRef))
{
        OSErr err = FSOpenResourceFile(&fileRef, 0, NULL, fsRdPerm, &ref);
        if (err == noErr)
        {
                // do stuff...
        }
}

err returns -39 which is eofErr.. I also tried this:

ResFileRefNum ref;
HFSUniStr255 forkName;
FSRef fileRef;
CFURLRef url = (CFURLRef)[NSURL fileURLWithPath: myPathString];
if (CFURLGetFSRef(url, &fileRef))
{
FSGetCatalogInfo(&fileRef, kFSCatInfoNone, NULL, &forkName, NULL, NULL); OSErr err = FSOpenResourceFile(&fileRef, forkName.length, forkName.unicode, fsRdPerm, &ref);
        if (err == noErr)
        {
                // do stuff...
        }
}

err returns -1402 which is errFSBadForkName

I'm lost on how I should port this from Tiger to Leopard, any ideas or hints how this has to be done ???

Many Thanks.


_______________________________________________

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 arch...@mail-archive.com

Reply via email to