PBSetVolSync
PBSetVol Set default volume or directory
#include <Files.h> File Manager (PBxxx)
OSErr PBSetVol(pb, async ); Boolean async ; 0=await completion; 1=immediate return Use PBSetVol to select a default volume. The File Manager will use this volume in future calls in which you specify no volume name and a volume
reference number of 0.
pb is the address of a 64-byte VolumeParam structure or any of the variants which contain all the relevant fields:
Out-In Name Type Size Offset Description
-> ioCompletion ProcPtr 4 12 Completion routine address (if async =TRUE) <- ioResult OSErr 2 16 Error Code (0=no error, 1=not done yet) -> ioNamePtr StringPtr 4 18 Address of full or partial pathname (Pascal-style)
-> ioVRefNum short 2 22 Volume reference of desired default
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 (use NIL, not an empty string)
nsvErr (-35) No such volume
paramErr (-50) No default volume
Notes: PBSetVol selects ioNamePtr or ioVRefNum as the new default volume. It
is legal to use a working directory number as the ' volume' number (see
PBOpenWD). In that case, a subsequent call to PBGetVol will return
that directory reference, rather than a volume reference.
It's probably just as (or more) efficient to use PBHSetVol to select both
a default volume and default working directory. Or better yet, forget the
idea of a default and always use volume or directory numbers in the File
Manager calls.
If you are using a string in the ioNamePtr field to specify a volume name,
the string must be in the following form
myVolParam.ioNamePtr = "\pMy HardDisk:
The trailing colon on the string indicates that we are referring to a
directory, not a file.