home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l041 / 2.ddi / MISC.ARC / TAINST.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1987-12-31  |  3.8 KB  |  135 lines

  1. (****************************************************************)
  2. (*                     DATABASE TOOLBOX 4.0                     *)
  3. (*     Copyright (c) 1984, 87 by Borland International, Inc.    *)
  4. (*                                                              *)
  5. (*                          TAInst                              *)
  6. (*                                                              *)
  7. (*  Purpose: Directory Installation program for TABuild         *)
  8. (*                                                              *)
  9. (****************************************************************)
  10. program TAInStall;
  11. uses CRT,
  12.      MiscTool,
  13. {    If a compiler error occurs here, you need to unpack the source
  14.      to the MiscTool unit from the archived file Tools.arc.  See the
  15.      README file on disk 1 for detailed instructions. }
  16.  
  17.      EditLn,
  18.      Config;
  19.  
  20. {$V-}
  21. {$I Paths.inc}
  22.  
  23. const
  24.   Version = '4.00';
  25.   CopyrightMsg = 'Copyright (C)';
  26.   Year = '1987';
  27.   Company = 'Borland International';
  28.   ProgName = 'TAInst';
  29.   TABuild = 'TABuild.exe';
  30.   LoadDefaults = true;
  31.   StoreDefaults = false;
  32.  
  33. const
  34.   Terminators : CharSet = [Esc, CR, UpKey, DownKey];
  35.  
  36. type
  37.    InstallNames = (TurboPathName, TAccessPathName);
  38.    InstallRec = record
  39.                   Prompt : String[30];
  40.                   X, Y : byte;
  41.                   P : PathName;
  42.                 end;
  43. const
  44.    TABuildPaths : array[InstallNames] of InstallRec =
  45.      ((Prompt : 'Turbo Pascal Directory: '; X : 0; Y : 0; P : ''),
  46.       (Prompt : 'Turbo Access Directory: '; X : 0; Y : 0; P : ''));
  47.  
  48. procedure GetPath(var CurPath : InstallRec;
  49.                   var TC : char);
  50. const
  51.   Printable : CharSet = [#32..#127];
  52.  
  53. var
  54.   Path : PathName;
  55.  
  56. begin
  57.   with CurPath do
  58.   begin
  59.     Path := P;
  60.     EditLine(Path, SizeOf(PathName) - 1, x, y,
  61.              Printable, Terminators, TC);
  62.     if TC <> Esc then
  63.     begin
  64.       Path := UpCaseStr(Path);
  65.       if (Path <> '') and (Path[Length(Path)] <> '\') then
  66.         Path := Path + '\';
  67.     end
  68.     else
  69.       Path := P;
  70.     P := Path;
  71.   end;
  72. end;
  73.  
  74.  
  75. procedure InstallPaths(var TurboPath, TAccessPath : PathName);
  76. var
  77.   TC : char;
  78.   CurPath : InstallNames;
  79.   done : boolean;
  80.  
  81. begin
  82.   CfgReplace(TABuild, head, tail, LoadDefaults);
  83.   if TAccessPath = '' then
  84.     GetDir(0, TAccessPath);
  85.   TABuildPaths[TurboPathName].P := TurboPath;
  86.   TABuildPaths[TAccessPathName].P := TAccessPath;
  87.   for CurPath := TurboPathName to TAccessPathName do
  88.     with TABuildPaths[CurPath] do
  89.     begin
  90.       Write(Prompt);
  91.       X := WhereX; Y := WhereY;
  92.       Writeln(P);
  93.       Writeln;
  94.     end;
  95.   CurPath := TurboPathName;
  96.   done := false;
  97.   repeat
  98.     GetPath(TABuildPaths[CurPath], TC);
  99.     case TC of
  100.       CR : if CurPath = TAccessPathName then
  101.             done := true
  102.            else
  103.              CurPath := succ(CurPath);
  104.       DownKey,
  105.       UpKey : if CurPath = TurboPathName then
  106.                  CurPath := TAccessPathName
  107.                else
  108.                  CurPath := TurboPathName;
  109.       Esc : ;
  110.     end;
  111.   until done;
  112.   TurboPath := TABuildPaths[TurboPathName].P;
  113.   TAccessPath := TABuildPaths[TAccessPathName].P;
  114. end; { InstallPaths }
  115.  
  116. procedure StartUp;
  117. begin
  118.   ClrScr;
  119.   Writeln(ProgName, ' version ', Version);
  120.   Writeln(CopyrightMsg, ' ', Year, ' ', Company);
  121.   Writeln;
  122.   Writeln(Progname, ' installs ', TABuild, ' with your system information so that');
  123.   Writeln('TABuild will be able to find the Turbo Pascal command line compiler');
  124.   Writeln('and the necessary Turbo Access files.');
  125.   Writeln;
  126.   if not CFGExist(TABuild) then
  127.     CfgAbort(TABuild + ' must be in the current directory');
  128. end;
  129.  
  130. begin
  131.   StartUp;
  132.   InstallPaths(TurboPath, TAccessPath);
  133.   CfgReplace(TABuild , head, tail, StoreDefaults);
  134. end.
  135.