SetFInfo
SetFInfo Change file type, creator, icon position, etc.
#include <Files.h> File Manager
OSErr SetFInfo( fileName, vRefNum, fndrInfo );
Str255 fileName ; address of length-prefixed full or partial name
short vRefNum ; volume or working directory reference
FInfo *fndrInfo ; address of a 16-byte FInfo structure
returns Error Code; 0=no error
SetFInfo changes Finder-specific information about a file. This includes the
file's type, the signature of its creator, Finder flags (such as whether the icon
is displayed), and the display position of the file's icon within its window.
fileName is the address of a length-prefixed, pascal-style string containing
the name of the target file. It may be a partial or full pathname,
depending upon the value of vRefNum .
vRefNum is the reference number of the volume or working directory
containing the file or directory fileName. 0 indicates the default
volume.
fndrInfo is the address of a 16-byte FInfo structure containing the desired
values of Finder specific information to be changed. Normal usage is
to pre-set all fields with current values by first calling GetFInfo,
then change only those fields which you wish to modify.
Returns: an operating system Error Code. It will be one of:
noErr (0) No error
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: SetFInfo is a functional subset of the low-level PBSetFInfo call ( which
allows you to change the file's date/time information as well as its
Finder-specific data).
The FInfo structure maintains the primary information used by the Finder
in locating the icon to display, where to display it, and which application to
run when its icon is double-clicked. It is the same information as in the
ioFlFndrInfo field of the FileParam structure, which is passed to custom
"file filters" used in the Standard File Package (see SFGetFile).
Additional Finder information is maintained in an FXInfo structure, which
can be obtained via PBGetCatInfo. In all operations in which you modify
file-de scriptive information, the normal usage is to obtain a copy of the
current information before modifying selected fields and updating the disk,
as in the following example.
Example
#include <Files.h>
short rc;
rc=GetFInfo( "\pHardDisk:Ltrs:Smith", 0, &fi ); /* get current info */
if ( rc ) { /* . . . handle the error . . . */ }
fi.fdType = 'TEXT'; /* change the file's type */
fi.fdFlags |= fIn visible; /* make icon invisible */
rc=SetFInfo( "\pHardDisk:Ltrs:Smith", 0, &fi ); /* update with changes */
if ( rc ) { /* . . . handle the error . . . */ }