issue porting resource files code from 10.4 to 10.5
issue porting resource files code from 10.4 to 10.5
- Subject: issue porting resource files code from 10.4 to 10.5
- From: Victor Bovio <email@hidden>
- Date: Thu, 28 May 2009 11:14:25 -0500
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 (email@hidden)
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:
This email sent to email@hidden