Previous Book Contents Book Index Next

Inside Macintosh: Files /
Chapter 2 - File Manager / Using the File Manager


Creating File System Specification Records

Sometimes it is useful for your application to create a file system specification record. For example, your application might be running in an environment where the enhanced Standard File Package routines (which return FSSpec records) are unavailable but the File Manager routines that accept FSSpec records are available (perhaps as glue code in your development system). You can call the FSMakeFSSpec function (or its low-level equivalent PBMakeFSSpec) to initialize a file system specification record.

Three of the parameters to FSMakeFSSpec represent the volume, parent directory, and file specifications of the target object. You can provide this information in any of the four combinations described in "HFS Specifications" beginning on page 2-28. Table 2-10 details the ways your application can identify the name and location of a file or directory in a call to FSMakeFSSpec.

The fourth parameter to FSMakeFSSpec is a pointer to the FSSpec record.
Table 2-10 How FSMakeFSSpec interprets its parameters
vRefNumdirIDfileNameInterpretation
Ignored IgnoredFull pathnameFull pathname overrides any other information
Volume reference number or drive numberDirectory IDPartial pathnamePartial pathname starts in the directory whose parent is specified in the dirID parameter
Working directory reference numberDirectory IDPartial pathnameDirectory specification in the dirID parameter overrides the directory implied by the reference number

Partial pathname starts in the directory whose parent is specified in dirID

Volume reference number or drive number0Partial pathnamePartial pathname starts in the root directory of the volume in vRefNum
Working directory reference number0Partial pathnamePartial pathname starts in the directory specified by the working directory
reference number
Volume reference number of drive Directory IDEmpty string
or NIL
The target object is the directory specified by the directory ID in dirID
Working directory reference number0Empty string
or NIL
The target object is the directory specified by the working directory reference number
in vRefNum
Volume reference number or drive number0Empty string
or NIL
The target object is the volume specified
in vRefNum
0Directory IDEmpty string
or NIL
The target object is the directory specified in dirID on the default volume
0Directory IDPartial pathnamePartial pathname starts in the directory specified in dirID on the default volume
00Empty string
or NIL
The target object is the default directory on the default volume
00Partial pathnamePartial pathname starts in the default directory on the default volume


Previous Book Contents Book Index Next

© Apple Computer, Inc.
2 JUL 1996