home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR24 / CDSG.ZIP / CDG.PAS < prev    next >
Pascal/Delphi Source File  |  1993-09-20  |  1KB  |  31 lines

  1. uses TpDos, DOS;
  2. var storedPath, CDSGdir, keyName : string;
  3.     cdsgfile : text;
  4.     x : integer;
  5.  
  6. procedure error(s:string);
  7. begin
  8.   writeln('Error: ',s);
  9.   writeln('Type CDS for instructions.');
  10.   writeln;
  11.   halt(1);
  12.   end;
  13.  
  14. begin
  15.   writeln('Change Directory Set/Go - by GLen');
  16.   CDSGdir:=GetEnv('CDSG');
  17.   if CDSGdir='' then error ('Environment string CDSG is not set.');
  18.   if ParamCount=0 then error ('No key given.');
  19.   keyName:=ParamStr(1);
  20.   assign(cdsgfile,CDSGdir+'\'+keyName);
  21.   if IOResult <> 0 then error('Error with Environment string CDSG.');
  22.   reset(cdsgfile);
  23.   if IOResult <> 0 then error('Given key "'+keyName+'" not previously set.');
  24.   readln(cdsgfile,storedPath);
  25.   if storedPath='' then error('Error in CDSG system - file empty...');
  26.   SelectDrive(storedPath[1]);
  27.   if storedPath[1]<>defaultDrive then error('Drive "'+storedPath[1]+':" not available now.');
  28.   chdir(storedPath);
  29.   if IOResult <> 0 then error ('Path "'+storedPath+'" not found on drive.');
  30. end.
  31.