Important: The information in this document is obsolete and should not be used for new development.
FSMakeFSSpec
You can use theFSMakeFSSpec
function to initialize anFSSpec
record 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 thevRefNum
orfileName
parameter,dirID
can be set to 0.
If you explicitly specifydirID
(that is, if it has any value other than 0), and ifvRefNum
specifies a working directory reference number,dirID
overrides the directory ID included invRefNum
. If thefileName
parameter contains an empty string,FSMakeFSSpec
creates anFSSpec
record for a directory specified by either thedirID
orvRefNum
parameter.fileName
- A full or partial pathname. If
fileName
specifies a full pathname,FSMakeFSSpec
ignores both thevRefNum
anddirID
parameters. A partial pathname might identify only the final target, or it might include one or more parent directory names. IffileName
specifies a partial pathname, thenvRefNum
,dirID
, or both must be valid.spec
- A file system specification to be filled in by
FSMakeFSSpec
.DESCRIPTION
TheFSMakeFSSpec
function fills in the fields of thespec
parameter using the information contained in the other three parameters. CallFSMakeFSSpec
whenever you want to create anFSSpec
record.You can pass the input to
FSMakeFSSpec
in any of the ways described in "HFS Specifications" on page 2-28. See Table 2-10 on page 2-35 for information about the wayFSMakeFSSpec
interprets 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,
FSMakeFSSpec
fills in the record and then returnsfnfErr
instead 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 theFSpCreate
function.In addition to the result codes that follow,
FSMakeFSSpec
can return a number of other File Manager error codes. If your application receives any result code other thannoErr
orfnfErr
, all fields of the resultingFSSpec
record are set to 0.ASSEMBLY-LANGUAGE INFORMATION
The trap macro and routine selector forFSMakeFSSpec
are
Trap macro Selector _HighLevelHFSDispatch $0001 RESULT CODES
noErr 0 No error nsvErr -35 Volume doesn't exist fnfErr -43 File or directory does not exist ( FSSpec
is still valid)