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 / utilities.c < prev    next >
Text File  |  1993-11-18  |  2KB  |  73 lines

  1.  
  2. #pragma segment UTILS
  3.  
  4. /*
  5. ** This source code was written by Tim Endres
  6. ** Email: time@ice.com.
  7. ** USMail: 8840 Main Street, Whitmore Lake, MI  48189
  8. **
  9. ** Some portions of this application utilize sources
  10. ** that are copyrighted by ICE Engineering, Inc., and
  11. ** ICE Engineering retains all rights to those sources.
  12. **
  13. ** Neither ICE Engineering, Inc., nor Tim Endres, 
  14. ** warrants this source code for any reason, and neither
  15. ** party assumes any responsbility for the use of these
  16. ** sources, libraries, or applications. The user of these
  17. ** sources and binaries assumes all responsbilities for
  18. ** any resulting consequences.
  19. */
  20.  
  21. #include "tickle.h"
  22.  
  23.  
  24. CreateDirectory()
  25. {
  26. SFReply            myreply;
  27. Point            mypoint;
  28. char            folder_name[256];
  29. HVolumeParam    vparm;
  30. WDPBRec            wparm;
  31. HFileParam        hparm;
  32.  
  33.     mypoint.h = mypoint.v = 75;
  34.     strcpy(folder_name, "Untitled");
  35.     c2pstr(folder_name);
  36.     MyPutFile(mypoint, "\pNew Folder:", folder_name, NULL, &myreply);
  37.     if (! myreply.good)
  38.         return;
  39.     
  40.     vparm.ioCompletion = 0;
  41.     vparm.ioNamePtr = NULL;
  42.     vparm.ioVRefNum = myreply.vRefNum;
  43.     vparm.ioVolIndex = 0;
  44.     vparm.ioVSigWord = 0;
  45.     PBHGetVInfo((HParmBlkPtr)&vparm, FALSE);
  46.     if (vparm.ioVSigWord != 0x4244) {
  47.         message_alert("Can not create directories on flat file system.");
  48.         return;
  49.         }
  50.     
  51.     wparm.ioCompletion = 0;
  52.     wparm.ioNamePtr = NULL;
  53.     wparm.ioVRefNum = myreply.vRefNum;
  54.     wparm.ioWDIndex = 0;
  55.     wparm.ioWDProcID = 0L;
  56.     PBGetWDInfo(&wparm, false);
  57.     if (wparm.ioResult != noErr) {
  58.         message_alert("Error #%d getting directory info.", wparm.ioResult);
  59.         return;
  60.         }
  61.  
  62.     hparm.ioCompletion = 0;
  63.     hparm.ioNamePtr = myreply.fName;
  64.     hparm.ioVRefNum = myreply.vRefNum;
  65.     hparm.ioDirID = wparm.ioWDDirID;
  66.     PBDirCreate((HParmBlkPtr)&hparm, false);
  67.     if (hparm.ioResult != noErr) {
  68.         message_alert("Error #%d creating directory <%.*s>.",
  69.                         hparm.ioResult, myreply.fName[0], &myreply.fName[1]);
  70.         }
  71.     }
  72.  
  73.