Important: The information in this document is obsolete and should not be used for new development.
FSMakeFSSpec
You can use theFSMakeFSSpecfunction to initialize anFSSpecrecord to particular values for a file or directory.
FUNCTION FSMakeFSSpec (vRefNum: Integer; dirID: LongInt; fileName: Str255; VAR spec: FSSpec): OSErr;
vRefNum- A volume specification. This parameter can contain a volume reference number, a working directory reference number, a drive number, or 0 (to specify the default volume).
dirID- A directory specification. This parameter usually specifies the parent directory ID of the target object. If the directory is sufficiently specified by either the
vRefNumorfileNameparameter,dirIDcan be set to 0. If you explicitly specifydirID(that is, if it has any value other than 0), and ifvRefNumspecifies a working directory reference number,dirIDoverrides the directory ID included invRefNum. If thefileNameparameter contains an empty string,FSMakeFSSpeccreates anFSSpecrecord for a directory specified by either thedirIDorvRefNumparameter.fileName- A full or partial pathname. If
fileNamespecifies a full pathname,FSMakeFSSpecignores both thevRefNumanddirIDparameters. A partial pathname might identify only the final target, or it might include one or more parent directory names. IffileNamespecifies a partial pathname, thenvRefNum,dirID, or both must be valid.spec- A file system specification to be filled in by
FSMakeFSSpec.DESCRIPTION
TheFSMakeFSSpecfunction fills in the fields of thespecparameter using the information contained in the other three parameters. CallFSMakeFSSpecwhenever
you want to create anFSSpecrecord.You can pass the input to
FSMakeFSSpecin several ways. The chapter "File
Manager" in this book explains howFSMakeFSSpecinterprets its input.If the specified volume is mounted and the specified parent directory exists, but the target file or directory doesn't exist in that location,
FSMakeFSSpecfills in the record and then returnsfnfErrinstead ofnoErr. The record is valid, but it describes a target that doesn't exist. You can use the record for other operations, such as creating a file with theFSpCreatefunction.In addition to the result codes that follow,
FSMakeFSSpeccan return a number of other File Manager error codes. If your application receives any result code other thannoErrorfnfErr, all fields of the resultingFSSpecrecord are set to 0.RESULT CODES
noErr 0 No error nsvErr -35 Volume doesn't exist fnfErr -43 File or directory does not exist ( FSSpecis still valid)