This commit is contained in:
gbeauche 2006-04-04 07:08:12 +00:00
parent 896ada92dc
commit bc9c586afc

View File

@ -103,7 +103,7 @@ void add_rsrc(const char *path, char *dest)
* Resource forks on Mac OS X are kept on a UFS volume as /path/file/rsrc * Resource forks on Mac OS X are kept on a UFS volume as /path/file/rsrc
* *
* On HFS volumes, there is of course the data and rsrc fork, but the Darwin * On HFS volumes, there is of course the data and rsrc fork, but the Darwin
* filesystem layer presents the resource fork using the above psuedo path * filesystem layer presents the resource fork using the above pseudo path
*/ */
static int open_rsrc(const char *path, int flag) static int open_rsrc(const char *path, int flag)
@ -232,15 +232,18 @@ void get_finfo(const char *path, uint32 finfo, uint32 fxinfo, bool is_dir)
if ( status == noErr ) if ( status == noErr )
{ {
FSCatalogInfo cInfo; FSCatalogInfo cInfo;
uint32 AllFinderInfo = kFSCatInfoFinderInfo + kFSCatInfoFinderXInfo; uint32 AllFinderInfo = kFSCatInfoFinderInfo;
if (fxinfo)
AllFinderInfo |= kFSCatInfoFinderXInfo;
status = FSGetCatalogInfo(&fsRef, AllFinderInfo, &cInfo, NULL, NULL, NULL); status = FSGetCatalogInfo(&fsRef, AllFinderInfo, &cInfo, NULL, NULL, NULL);
if ( status == noErr ) if ( status == noErr )
{ {
D(printf("get_finfo(%s,...) - Got info of '%16.16s'\n", path, cInfo.finderInfo)); D(printf("get_finfo(%s,...) - Got info of '%16.16s'\n", path, cInfo.finderInfo));
Host2Mac_memcpy(finfo, cInfo.finderInfo, SIZEOF_FInfo); Host2Mac_memcpy(finfo, &cInfo.finderInfo, SIZEOF_FInfo);
if (fxinfo) if (fxinfo)
Host2Mac_memcpy(fxinfo, cInfo.extFinderInfo, SIZEOF_FXInfo); Host2Mac_memcpy(fxinfo, &cInfo.extFinderInfo, SIZEOF_FXInfo);
return; return;
} }
else else
@ -286,9 +289,16 @@ void set_finfo(const char *path, uint32 finfo, uint32 fxinfo, bool is_dir)
status = FSGetCatalogInfo(&fsRef, kFSCatInfoFinderInfo, &cInfo, NULL, NULL, NULL); status = FSGetCatalogInfo(&fsRef, kFSCatInfoFinderInfo, &cInfo, NULL, NULL, NULL);
if ( status == noErr ) if ( status == noErr )
{ {
Mac2Host_memcpy(cInfo.finderInfo, finfo, SIZEOF_FInfo); FSCatalogInfoBitmap whichInfo = kFSCatInfoNone;
Mac2Host_memcpy(cInfo.extFinderInfo, fxinfo, SIZEOF_FXInfo); if (finfo) {
FSSetCatalogInfo(&fsRef, kFSCatInfoFinderInfo, &cInfo); whichInfo |= kFSCatInfoFinderInfo;
Mac2Host_memcpy(&cInfo.finderInfo, finfo, SIZEOF_FInfo);
}
if (fxinfo) {
whichInfo |= kFSCatInfoFinderXInfo;
Mac2Host_memcpy(&cInfo.extFinderInfo, fxinfo, SIZEOF_FXInfo);
}
FSSetCatalogInfo(&fsRef, whichInfo, &cInfo);
} }
} }
} }