Codetools: In function IsCompilerExecutable fix dcc extension check and fix return value.

git-svn-id: trunk@62634 -
This commit is contained in:
juha 2020-02-16 16:10:46 +00:00
parent 6483f57d33
commit ec192ce438

View File

@ -3892,10 +3892,8 @@ end;
function IsCTExecutable(AFilename: string; out ErrorMsg: string): boolean; function IsCTExecutable(AFilename: string; out ErrorMsg: string): boolean;
begin begin
Result:=false; Result:=false;
AFilename:=ResolveDots(aFilename); AFilename:=ResolveDots(AFilename);
//debugln(['IsFPCExecutable ',AFilename]); if AFilename='' then begin
//debugln(['IsFPCompiler START ',aFilename]);
if aFilename='' then begin
ErrorMsg:='missing file name'; ErrorMsg:='missing file name';
exit; exit;
end; end;
@ -3946,13 +3944,13 @@ var
Lines: TStringList; Lines: TStringList;
i: Integer; i: Integer;
begin begin
Result:=IsCTExecutable(AFilename,ErrorMsg); Result:=False;
if not Result then exit; if not IsCTExecutable(AFilename,ErrorMsg) then exit;
Kind:=pcFPC; Kind:=pcFPC;
// allow scripts like fpc.sh and fpc.bat // allow scripts like fpc.sh and fpc.bat
ShortFilename:=ExtractFileNameOnly(AFilename); ShortFilename:=ExtractFileNameOnly(AFilename);
//debugln(['IsFPCompiler Short=',ShortFilename]); //debugln(['IsCompilerExecutable Short=',ShortFilename]);
// check ppc*.exe // check ppc*.exe
if CompareText(LeftStr(ShortFilename,3),'ppc')=0 then if CompareText(LeftStr(ShortFilename,3),'ppc')=0 then
@ -3966,7 +3964,7 @@ begin
// dcc*.exe // dcc*.exe
if (CompareFilenames(LeftStr(ShortFilename,3),'dcc')=0) if (CompareFilenames(LeftStr(ShortFilename,3),'dcc')=0)
and ((ExeExt='') or (CompareFileExt(ShortFilename,ExeExt)=0)) and ((ExeExt='') or (CompareFileExt(AFilename,ExeExt)=0))
then begin then begin
Kind:=pcDelphi; Kind:=pcDelphi;
exit(true); exit(true);
@ -4010,7 +4008,6 @@ begin
exit(true); exit(true);
ErrorMsg:='fpc executable should start with fpc or ppc'; ErrorMsg:='fpc executable should start with fpc or ppc';
Result:=false;
end; end;
function IsFPCExecutable(AFilename: string; out ErrorMsg: string; Run: boolean function IsFPCExecutable(AFilename: string; out ErrorMsg: string; Run: boolean
@ -4029,7 +4026,7 @@ begin
// allow scripts like fpc*.sh and fpc*.bat // allow scripts like fpc*.sh and fpc*.bat
ShortFilename:=LowerCase(ExtractFileNameOnly(AFilename)); ShortFilename:=LowerCase(ExtractFileNameOnly(AFilename));
//debugln(['IsFPCompiler Short=',ShortFilename]); //debugln(['IsFPCExecutable Short=',ShortFilename]);
if (LeftStr(ShortFilename,3)='fpc') then if (LeftStr(ShortFilename,3)='fpc') then
exit(true); exit(true);