home *** CD-ROM | disk | FTP | other *** search
- 18-Jun-88 14:39:26-MDT,2328;000000000000
- Return-Path: <u-lchoqu%sunset@cs.utah.edu>
- Received: from cs.utah.edu by SIMTEL20.ARPA with TCP; Sat, 18 Jun 88 14:39:21 MDT
- Received: by cs.utah.edu (5.54/utah-2.0-cs)
- id AA22557; Sat, 18 Jun 88 14:39:19 MDT
- Received: by sunset.utah.edu (5.54/utah-2.0-leaf)
- id AA24733; Sat, 18 Jun 88 14:39:17 MDT
- Date: Sat, 18 Jun 88 14:39:17 MDT
- From: u-lchoqu%sunset@cs.utah.edu (Lee Choquette)
- Message-Id: <8806182039.AA24733@sunset.utah.edu>
- To: rthum@simtel20.arpa
- Subject: SFSetDir.c
-
- /****************************************************************
- * "SFSetDir.c" - Set SFGet/PutFile directory. *
- * *
- * This routine sets the directory to which the next SFGet or *
- * SFPut file call will open. It works under MFS and HFS. *
- * *
- * Author: Dave Warker (who is Wombat Software) *
- * CompuServe: 70406,626 *
- * Delphi: DAVEWARKER *
- * *
- * 17-Mar-88 dww Module created. *
- ****************************************************************/
-
- #include <FileMgr.h>
- #include <Hfs.h>
- #include <StdFilePkg.h>
-
- void SFSetDir(theDir, tryProc)
- int theDir; /* volume reference or working directory ref num */
- OSType tryProc; /* set to non-zero to try this WFD proc ID first */
- /*
- * Set directory for next SFGet or SFPut file.
- * You should normally set "tryProc" to 0L unless you have explicitly
- * opened a working directory and want to try to match it exactly
- * before trying the general pool of working directories.
- */
- {
- /* assume MFS or not working directory ID */
- SFSaveDisk = -theDir;
-
- if (FSFCBLen > 0)
- {
- /* HFS available, may be working directory */
- WDPBRec wdinfo;
-
- wdinfo.ioCompletion = 0L;
- wdinfo.ioVRefNum = theDir;
- wdinfo.ioWDIndex = 0;
- wdinfo.ioWDVRefNum = 0;
-
- /* try for working directory with requested proc ID */
- wdinfo.ioWDProcID = tryProc;
- if (PBGetWDInfo(&wdinfo, FALSE) != noErr)
- {
- /* failed, try for any proc ID */
- wdinfo.ioWDProcID = 0;
- if (PBGetWDInfo(&wdinfo, FALSE) != noErr)
- {
- /* that failed too, assume it is a volume ref */
- CurDirStore = 0;
- return;
- }
- }
-
- /* we have info for this working ID, setup for SF(Get/Put)File */
- SFSaveDisk = -wdinfo.ioWDVRefNum;
- CurDirStore = wdinfo.ioWDDirID;
- }
- }
-