Replace calls to HSetFInfo() with PBHSetFInfoSync().

This commit is contained in:
2021-03-14 06:44:56 +00:00
parent 6e71a9c25d
commit c47a41cecc
2 changed files with 72 additions and 34 deletions

View File

@@ -61,8 +61,8 @@ void FileAttributes(const char* path)
int16_t refFile;
int32_t dirId;
FInfo finderInfo;
int32_t count;
HFileInfo* fpb;
int32_t count;
HParamBlockRec fpb;
CInfoPBRec cipbr;
HParamBlockRec dirPB;
int i;
@@ -112,15 +112,23 @@ void FileAttributes(const char* path)
if(!rc)
{
count = strlen(mac_attrs[i].contents);
wRc = FSWrite(refFile, &count, mac_attrs[i].contents);
cRc = FSClose(refFile);
finderInfo.fdType = mac_attrs[i].type;
finderInfo.fdCreator = mac_attrs[i].creator;
finderInfo.fdFlags = mac_attrs[i].flags;
finderInfo.fdLocation.h = mac_attrs[i].location.h;
finderInfo.fdLocation.v = mac_attrs[i].location.v;
rc = HSetFInfo(refNum, dirId, mac_attrs[i].filename, &finderInfo);
memset(&fpb, 0, sizeof(HParamBlockRec));
count = strlen(mac_attrs[i].contents);
wRc = FSWrite(refFile, &count, mac_attrs[i].contents);
cRc = FSClose(refFile);
fpb.fileParam.ioVRefNum = refNum;
fpb.fileParam.ioNamePtr = str255;
fpb.fileParam.ioDirID = dirId;
fpb.fileParam.ioFDirIndex = 0;
fpb.fileParam.ioFlFndrInfo.fdType = mac_attrs[i].type;
fpb.fileParam.ioFlFndrInfo.fdCreator = mac_attrs[i].creator;
fpb.fileParam.ioFlFndrInfo.fdFlags = mac_attrs[i].flags;
fpb.fileParam.ioFlFndrInfo.fdLocation.h = mac_attrs[i].location.h;
fpb.fileParam.ioFlFndrInfo.fdLocation.v = mac_attrs[i].location.v;
rc = PBHSetFInfoSync(&fpb);
}
}

View File

@@ -99,8 +99,8 @@ void ResourceFork(const char* path)
int16_t refFile;
int32_t dirId;
FInfo finderInfo;
int32_t count;
HFileInfo* fpb;
int32_t count;
HParamBlockRec fpb;
CInfoPBRec cipbr;
HParamBlockRec dirPB;
@@ -150,13 +150,20 @@ void ResourceFork(const char* path)
rc = HOpenDF(refNum, dirId, "\pICON", 0, &refFile);
if(!rc)
{
count = strlen(rsrcText);
wRc = FSWrite(refFile, &count, rsrcText);
cRc = FSClose(refFile);
finderInfo.fdType = ftGenericDocumentPC;
finderInfo.fdCreator = ostAaru;
finderInfo.fdFlags = kHasCustomIcon;
rc = HSetFInfo(refNum, dirId, "\pICON", &finderInfo);
memset(&fpb, 0, sizeof(HParamBlockRec));
count = strlen(rsrcText);
wRc = FSWrite(refFile, &count, rsrcText);
cRc = FSClose(refFile);
fpb.fileParam.ioVRefNum = refNum;
fpb.fileParam.ioNamePtr = "\pICON";
fpb.fileParam.ioDirID = dirId;
fpb.fileParam.ioFlFndrInfo.fdType = ftGenericDocumentPC;
fpb.fileParam.ioFlFndrInfo.fdCreator = ostAaru;
fpb.fileParam.ioFlFndrInfo.fdFlags = kHasCustomIcon;
rc = PBHSetFInfoSync(&fpb);
}
}
printf("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d\n",
@@ -181,12 +188,21 @@ void ResourceFork(const char* path)
rc = HOpenDF(refNum, dirId, "\pPICT", 0, &refFile);
if(!rc)
{
memset(&fpb, 0, sizeof(HParamBlockRec));
count = strlen(rsrcText);
wRc = FSWrite(refFile, &count, rsrcText);
cRc = FSClose(refFile);
finderInfo.fdType = ftPICTFile;
finderInfo.fdCreator = ostAaru;
rc = HSetFInfo(refNum, dirId, "\pPICT", &finderInfo);
fpb.fileParam.ioVRefNum = refNum;
fpb.fileParam.ioNamePtr = "\pPICT";
fpb.fileParam.ioDirID = dirId;
fpb.fileParam.ioFlFndrInfo.fdType = ftPICTFile;
fpb.fileParam.ioFlFndrInfo.fdCreator = ostAaru;
rc = PBHSetFInfoSync(&fpb);
}
}
printf("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d\n",
@@ -211,12 +227,19 @@ void ResourceFork(const char* path)
rc = HOpenDF(refNum, dirId, "\pVERSION", 0, &refFile);
if(!rc)
{
count = strlen(rsrcText);
wRc = FSWrite(refFile, &count, rsrcText);
cRc = FSClose(refFile);
finderInfo.fdType = ftGenericDocumentPC;
finderInfo.fdCreator = ostAaru;
rc = HSetFInfo(refNum, dirId, "\pVERSION", &finderInfo);
memset(&fpb, 0, sizeof(HParamBlockRec));
count = strlen(rsrcText);
wRc = FSWrite(refFile, &count, rsrcText);
cRc = FSClose(refFile);
fpb.fileParam.ioVRefNum = refNum;
fpb.fileParam.ioNamePtr = "\pVERSION";
fpb.fileParam.ioDirID = dirId;
fpb.fileParam.ioFlFndrInfo.fdType = ftGenericDocumentPC;
fpb.fileParam.ioFlFndrInfo.fdCreator = ostAaru;
rc = PBHSetFInfoSync(&fpb);
}
}
printf("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d\n",
@@ -257,13 +280,20 @@ void ResourceFork(const char* path)
rc = HOpenDF(refNum, dirId, "\pALL", 0, &refFile);
if(!rc)
{
count = strlen(rsrcText);
wRc = FSWrite(refFile, &count, rsrcText);
cRc = FSClose(refFile);
finderInfo.fdType = ftPICTFile;
finderInfo.fdCreator = ostAaru;
finderInfo.fdFlags = kHasCustomIcon;
rc = HSetFInfo(refNum, dirId, "\pALL", &finderInfo);
memset(&fpb, 0, sizeof(HParamBlockRec));
count = strlen(rsrcText);
wRc = FSWrite(refFile, &count, rsrcText);
cRc = FSClose(refFile);
fpb.fileParam.ioVRefNum = refNum;
fpb.fileParam.ioNamePtr = "\pALL";
fpb.fileParam.ioDirID = dirId;
fpb.fileParam.ioFlFndrInfo.fdType = ftPICTFile;
fpb.fileParam.ioFlFndrInfo.fdCreator = ostAaru;
fpb.fileParam.ioFlFndrInfo.fdFlags = kHasCustomIcon;
rc = PBHSetFInfoSync(&fpb);
}
}
printf("\tFile with three items in the resource fork: name = \"%s\", rc = %d, wRc = %d, cRc = %d, rRc = %d, rRc2 = "