int dir_GetMacFileTypeAndCreator(char *filename, int filenameSize, char *fType, char *fCreator) { /* Get the Macintosh type and creator of the given file. */ /* Note: On other platforms, this is just a noop. */ FSSpec spec; FInfo finderInfo; if (getSpecAndFInfo(filename,filenameSize,&spec,&finderInfo) != noErr) return false; *((int *) fType) = finderInfo.fdType; *((int *) fCreator) = finderInfo.fdCreator; return true; }
sqInt dir_SetMacFileTypeAndCreator(char *filename, sqInt filenameSize, char *fType, char *fCreator) { /* Set the Macintosh type and creator of the given file. */ /* Note: On other platforms, this is just a noop. */ FSSpec spec; FInfo finderInfo; if (getSpecAndFInfo(filename,filenameSize,&spec,&finderInfo) != noErr) return false; finderInfo.fdType = *((int *) fType); finderInfo.fdCreator = *((int *) fCreator); return FSpSetFInfo(&spec,&finderInfo) == noErr; }