home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 February / macformat-047.iso / Shareware Plus / Developers / DLOGManager 1.02 / Source Code / FileUtilities.cp < prev    next >
Encoding:
Text File  |  1996-09-16  |  1.2 KB  |  71 lines  |  [TEXT/KAHL]

  1. /*****
  2.  *    FileUtilities.c
  3.  *
  4.  *    Routines di utilità per i files.
  5.  *    © Com&Media, 1994
  6.  *
  7.  *    15/10/94    Scorporo da Utilities.h (Fabio Barbieri)
  8.  *    18/8/94        Prima stesura (Fabio Barbieri)
  9.  *
  10.  *
  11.  *****/
  12.  
  13.  
  14. /*****    Include standard        *****/
  15. #include <Files.h>
  16.  
  17. /*****    Include locali            *****/
  18. #include "FileUtilities.h"
  19.  
  20. /*****    Define macro            *****/
  21.  
  22. /*****    Define valori            *****/
  23.  
  24. #pragma segment FileUtilities
  25.  
  26. /*****    Typedef globali            *****/
  27.  
  28. /*****    Funzioni esterne        *****/
  29.  
  30. /*****    Variabili esterne        *****/
  31.  
  32. /*****    Variabili globali        *****/
  33.  
  34. /*****    Statiche globali        *****/
  35.  
  36. /*****    Function prototyping    *****/
  37.  
  38.  
  39. /****
  40.  *    GetCurrentWD(dirID, vRefNum)
  41.  *
  42.  *    Trova il volume corrente e la directory corrente, e ne pone gli ID rispettivamente
  43.  *    in <vRefNum> e in <dirID>.
  44.  *
  45.  ****/
  46.  
  47. OSErr    GetCurrentWD(long    *dirID, short    *vRefNum)
  48. {
  49.     WDPBRec    wdpb;
  50.     short    volRef;
  51.     OSErr    err;    
  52.  
  53.     err = GetVol(nil, &volRef);
  54.     if(err)
  55.         return(err);
  56.     
  57.     wdpb.ioNamePtr = nil;
  58.     wdpb.ioVRefNum = volRef;
  59.     wdpb.ioWDIndex = 0;
  60.     wdpb.ioWDProcID = 0;
  61.     wdpb.ioWDVRefNum = 0;
  62.     err = PBGetWDInfo(&wdpb, false);
  63.     if(err == noErr)
  64.     {
  65.         *vRefNum = volRef;
  66.         *dirID = wdpb.ioWDDirID;
  67.     }
  68.     return(err);
  69. }
  70. /* end GetCurrentWD */
  71.