home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / online / source / c / compilers / Tickle-4.0.sit.hqx / Tickle-4.0 / src / tar_dir.c < prev    next >
Text File  |  1993-10-25  |  2KB  |  113 lines

  1.  
  2. #pragma segment TAR
  3.  
  4. /*
  5.  * Macintosh Tar
  6.  *
  7.  * dir.c - routines dealing with directory selection
  8.  *
  9.  * Written by Craig Ruff
  10.  */
  11.  
  12. #include "tar.h"
  13. /*#include <stdio.h>*/
  14. /*#include "tge.h"*/
  15.  
  16. short        dirVRefNum;        /* Selected directory VRefNum */
  17. long        dirDirID;        /* Selected directory DirID */
  18.  
  19. #ifdef NEVER_DEFINED
  20. Boolean
  21. GetDir(text, extract)
  22. char    *text;
  23. Boolean    extract;
  24.     {
  25. #pragma unused (extract)
  26.     char    path_name[512];
  27.     
  28.     path_name[0] = '\0';
  29.     return GetFolderPathName("Directory To Archive:", path_name, &dirVRefNum, &dirDirID);
  30.     }
  31. #endif
  32.  
  33. #ifdef NEVER_DEFINED
  34.  
  35. #define ROOTDIR        2        /* WATCH OUT!  Subject to change? */
  36.  
  37. #define dirID        130        /* Directory selection dialog */
  38.  
  39. /*
  40.  * GetDir - manage the directory selection dialog
  41.  */
  42. Boolean
  43. GetDir(text, extract)
  44. char    *text;
  45. Boolean    extract;
  46. {
  47. #ifdef TCLAPPL
  48.     Point        where;
  49.     SFReply        reply;
  50.     WDPBRec        wdpb;
  51.     HParamBlockRec    volpb;
  52.     Str255        name;
  53.     char        *routine = "\pGetDir";
  54.     WindowPtr    myWindow;
  55.  
  56.     myWindow = FrontWindow();
  57.     if (WPeek->windowKind == tgeWKind)
  58.         tge_activate(myWindow, 0);
  59.  
  60.     name[0] = 1;
  61.     name[1] = 'x';
  62.     where.h = where.v = 75;
  63.     SFPPutFile(where, text, name, nil, &reply, dirID, nil);
  64.     if (!reply.good)
  65.         return(false);
  66.  
  67.     name[0] = 0;
  68.     volpb.volumeParam.ioCompletion = nil;
  69.     volpb.volumeParam.ioNamePtr = name;
  70.     volpb.volumeParam.ioVRefNum = reply.vRefNum;
  71.     volpb.volumeParam.ioVolIndex = 0;
  72.     PBHGetVInfo(&volpb, false);
  73.     if (volpb.volumeParam.ioResult != noErr) {
  74.         OSAlert(routine, "\pPBHGetVInfo", name,
  75.                 volpb.volumeParam.ioResult);
  76.         return(false);
  77.     }
  78.  
  79.     if (volpb.volumeParam.ioVSigWord != 0x4244) {
  80.         HFSAlert();
  81.         return(false);
  82.     }
  83.     
  84.     if (extract) {
  85.         /*
  86.          * If we are extracting, we only need a working
  87.          * directory vRefNum.  The SFPPutFile dialog
  88.          * provides this for us.
  89.          */
  90.         dirVRefNum = reply.vRefNum;
  91.     
  92.     } else {
  93.         wdpb.ioCompletion = nil;
  94.         wdpb.ioVRefNum = reply.vRefNum;
  95.         wdpb.ioWDIndex = 0;
  96.         wdpb.ioWDProcID = 0;
  97.         wdpb.ioWDVRefNum = 0;
  98.         if (PBGetWDInfo(&wdpb, false) != noErr) {
  99.             OSAlert("\pGetDir", "\pPBGetWDInfo", nil, wdpb.ioResult);
  100.             return(false);
  101.         }
  102.         
  103.         dirDirID = wdpb.ioWDDirID;
  104.         dirVRefNum = wdpb.ioWDVRefNum;
  105.     }
  106. #else
  107. #pragma unused (text, extract)
  108. #endif
  109.     return(true);
  110. }
  111.  
  112. #endif
  113.