mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 21:00:27 +02:00
* Use ExeSearch instead of FileSearch to find fpc executable
git-svn-id: trunk@12949 -
This commit is contained in:
parent
d4c2a35c75
commit
d4d733b173
@ -433,45 +433,11 @@ end;
|
|||||||
|
|
||||||
procedure TCompilerOptions.InitCompilerDefaults;
|
procedure TCompilerOptions.InitCompilerDefaults;
|
||||||
|
|
||||||
// Same as SysUtils.FileSearch but without searching in the current directory
|
|
||||||
Function FileSearchPath (Const Name, DirList : String) : String;
|
|
||||||
Var
|
|
||||||
I : longint;
|
|
||||||
Temp : String;
|
|
||||||
|
|
||||||
begin
|
|
||||||
Result:=Name;
|
|
||||||
temp:=SetDirSeparators(DirList);
|
|
||||||
while True do begin
|
|
||||||
If Temp = '' then
|
|
||||||
Break; // No more directories to search - fail
|
|
||||||
I:=pos(PathSeparator,Temp);
|
|
||||||
If I<>0 then
|
|
||||||
begin
|
|
||||||
Result:=Copy (Temp,1,i-1);
|
|
||||||
system.Delete(Temp,1,I);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
Result:=Temp;
|
|
||||||
Temp:='';
|
|
||||||
end;
|
|
||||||
If Result<>'' then
|
|
||||||
Result:=IncludeTrailingPathDelimiter(Result)+name;
|
|
||||||
If (Result <> '') and FileExists(Result) Then
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
result:='';
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
infoSL : TStringList;
|
infoSL : TStringList;
|
||||||
begin
|
begin
|
||||||
FConfigVersion:=CurrentConfigVersion;
|
FConfigVersion:=CurrentConfigVersion;
|
||||||
// Sysutils.FileSearch cannot be used since it also searches in the current
|
FCompiler:=ExeSearch('fpc'+ExeExt,GetEnvironmentVariable('PATH'));
|
||||||
// directory. Which could lead to a security-problem when some unknown
|
|
||||||
// 'fpc' executable is lying around.
|
|
||||||
FCompiler:=FileSearchPath('fpc'+ExeExt,GetEnvironmentVariable('PATH'));
|
|
||||||
if FCompiler='' then
|
if FCompiler='' then
|
||||||
Raise EPackagerError.Create(SErrMissingFPC);
|
Raise EPackagerError.Create(SErrMissingFPC);
|
||||||
// Detect compiler version/target from -i option
|
// Detect compiler version/target from -i option
|
||||||
|
Loading…
Reference in New Issue
Block a user