浏览代码

instantfpc: hint about environment variable INSTANTFPCCACHE

git-svn-id: trunk@18995 -
Mattias Gaertner 14 年之前
父节点
当前提交
927d080ab2
共有 2 个文件被更改,包括 14 次插入9 次删除
  1. 2 1
      utils/instantfpc/instantfpc.pas
  2. 12 8
      utils/instantfpc/instantfptools.pas

+ 2 - 1
utils/instantfpc/instantfpc.pas

@@ -54,7 +54,8 @@ begin
   writeln('      Prints cache directory to stdout.');
   writeln;
   writeln('instantfpc --set-cache=<path to cache>');
-  writeln('      Set the cache to be used.');
+  writeln('      Set the cache to be used. Otherwise using environment variable');
+  writeln('      INSTANTFPCCACHE.');
   writeln;
   writeln('instantfpc --compiler=<path to compiler>');
   writeln('      Normally fpc is searched in PATH and used as compiler.');

+ 12 - 8
utils/instantfpc/instantfptools.pas

@@ -13,6 +13,10 @@ unit InstantFPTools;
   {$define HASEXEEXT}
 {$endif go32v2}
 
+{$IFNDEF VER2_4}
+{$DEFINE UseExeSearch}
+{$ENDIF}
+
 interface
 
 uses
@@ -138,14 +142,14 @@ begin
 end;
 
 function GetCompiler: string;
-
 var
+  CompFile: String;
+{$IFNDEF UseExeSearch}
   Path: String;
   p: Integer;
   StartPos: LongInt;
   Dir: String;
-  CompFile: String;
-
+{$ENDIF}
 begin
   Result:=CmdCompiler;
   if (Result<>'') then
@@ -164,9 +168,11 @@ begin
   {$ELSE}
   CompFile:='fpc';
   {$ENDIF}
+  {$IFDEF UseExeSearch}
+  Result:=ExeSearch(CompFile);
+  {$ELSE}
   Path:=GetEnvironmentVariable('PATH');
-  {$IFDEF VER2_4}
-  if PATH<>'' then begin
+  if Path<>'' then begin
     p:=1;
     while p<=length(Path) do begin
       StartPos:=p;
@@ -179,8 +185,6 @@ begin
       inc(p);
     end;
   end;
-  {$ELSE}
-  Result:=ExeSearch(CompFile);
   {$ENDIF}
 
   if (Result='') then
@@ -213,7 +217,7 @@ begin
   Proc.Execute;
   ss:=TStringStream.Create('');
   repeat
-    Count:=Proc.Output.Read(Buf,4096);
+    Count:=Proc.Output.Read(Buf{%H-},4096);
     if Count>0 then
       ss.write(buf,count);
   until Count=0;