home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Garbo
/
Garbo.cdr
/
mac
/
source
/
tarsrc.sit
/
dir.c
< prev
next >
Wrap
Text File
|
1989-09-14
|
2KB
|
82 lines
/*
* Macintosh Tar
*
* dir.c - routines dealing with directory selection
*
* Written by Craig Ruff
*/
#include "tar.h"
#define ROOTDIR 2 /* WATCH OUT! Subject to change? */
#define dirID 130 /* Directory selection dialog */
short dirVRefNum; /* Selected directory VRefNum */
long dirDirID; /* Selected directory DirID */
/*
* GetDir - manage the directory selection dialog
*/
Boolean
GetDir(text, extract)
char *text;
Boolean extract;
{
Point where;
SFReply reply;
WDPBRec wdpb;
HParamBlockRec volpb;
Str255 name;
char *routine = "\pGetDir";
name[0] = 1;
name[1] = 'x';
where.h = where.v = 75;
SFPPutFile(where, text, name, nil, &reply, dirID, nil);
if (!reply.good)
return(false);
name[0] = 0;
volpb.volumeParam.ioCompletion = nil;
volpb.volumeParam.ioNamePtr = name;
volpb.volumeParam.ioVRefNum = reply.vRefNum;
volpb.volumeParam.ioVolIndex = 0;
PBHGetVInfo(&volpb, false);
if (volpb.volumeParam.ioResult != noErr) {
OSAlert(routine, "\pPBHGetVInfo", name,
volpb.volumeParam.ioResult);
return(false);
}
if (volpb.volumeParam.ioVSigWord != 0x4244) {
HFSAlert();
return(false);
}
if (extract) {
/*
* If we are extracting, we only need a working
* directory vRefNum. The SFPPutFile dialog
* provides this for us.
*/
dirVRefNum = reply.vRefNum;
} else {
wdpb.ioCompletion = nil;
wdpb.ioVRefNum = reply.vRefNum;
wdpb.ioWDIndex = 0;
wdpb.ioWDProcID = 0;
wdpb.ioWDVRefNum = 0;
if (PBGetWDInfo(&wdpb, false) != noErr) {
OSAlert("\pGetDir", "\pPBGetWDInfo", nil, wdpb.ioResult);
return(false);
}
dirDirID = wdpb.ioWDDirID;
dirVRefNum = wdpb.ioWDVRefNum;
}
return(true);
}