SETFILEINFO
PBSetFInfo Change a file's date and Finder information
#include <Files.h> File Manager (PBxxx)
OSErr PBSetFInfo(pb, async ); Boolean async ; 0=await completion; 1=immediate return PBSetFInfo lets you change a file's creation or modification date/time and
the information used by the Finder - the file's icon display location, the file
type and creator, and flag bits including whether or not the icon is displayed
by the Finder.
pb is the address of an 80-byte FileParam structure. The relevant fields are as follows:
Out-In Name Type Size Offset Description
-> ioCompletion ProcPtr 4 12 Completion routine address (if async =TRUE) -> ioNamePtr StringPtr 4 18 Address of full or partial path/ filename -> ioVRefNum short 2 22 Volume, drive, or working directory reference
-> ioFlFndrInfo FInfo 16 32 (File type, creator, flags, icon position, etc.) -> ioFlCrDat long 4 72 Date/Time of creation (seconds since 1/1/1904)
-> ioFlMdDat long 4 76 Date/Time of last modification
<- ioResult OSErr 2 16 Error Code (0=no error, 1=not done yet) async is a Boolean value. Use FALSE for normal (synchronous) operation or TRUE to enqueue the request and resume control immediately. See Async I/O.
noErr (0) No error
bdNamErr (-37) Bad name
extFSErr (-58) External file system
fLckdErr (-45) File is locked
fnfErr (-43) File not found
ioErr (-36) I/O error
nsvErr (-35) No such volume
vLckdErr (-46) Volume is locked
wPrErr (-44) Diskette is write-protected
Notes: Before calling PBSetFInfo, you should always call PBGetFInfo, in order to pre-set the parameter block with all the fields you do not wish to change.
See PBHSetFInfo for an example usage of the HFS-specific version of this function. The high-level SetFInfo is easier to use, but does not let you change the file's date/time information. The PBSetCatInfo function is more flexible, as it lets you perform similar actions on directories, as well
as files.