mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-16 02:49:21 +02:00
* Merging revisions 43227 from trunk:
------------------------------------------------------------------------ r43227 | michael | 2019-10-19 15:09:04 +0200 (Sat, 19 Oct 2019) | 1 line Search for .inc .pp .pas if an include file name has no extension ------------------------------------------------------------------------ git-svn-id: branches/fixes_3_2@43263 -
This commit is contained in:
parent
db1eb537c9
commit
cd1a714336
@ -2481,6 +2481,24 @@ function TFileResolver.FindIncludeFileName(const AName: string): String;
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Function FindInPath(FN : String) : String;
|
||||||
|
|
||||||
|
var
|
||||||
|
I : integer;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:='';
|
||||||
|
I:=0;
|
||||||
|
While (Result='') and (I<FIncludePaths.Count) do
|
||||||
|
begin
|
||||||
|
Result:=SearchLowUpCase(FIncludePaths[i]+FN);
|
||||||
|
Inc(I);
|
||||||
|
end;
|
||||||
|
// search in BaseDirectory
|
||||||
|
if (Result='') and (BaseDirectory<>'') then
|
||||||
|
Result:=SearchLowUpCase(BaseDirectory+FN);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
FN : string;
|
FN : string;
|
||||||
@ -2491,23 +2509,34 @@ begin
|
|||||||
FN:=SetDirSeparators(AName);
|
FN:=SetDirSeparators(AName);
|
||||||
If FilenameIsAbsolute(FN) then
|
If FilenameIsAbsolute(FN) then
|
||||||
begin
|
begin
|
||||||
// Maybe this should also do a SearchLowUpCase ?
|
Result := SearchLowUpCase(FN);
|
||||||
if FileExists(FN) then
|
if (Result='') and (ExtractFileExt(FN)='') then
|
||||||
Result := FN;
|
begin
|
||||||
|
Result:=SearchLowUpCase(FN+'.inc');
|
||||||
|
if Result='' then
|
||||||
|
begin
|
||||||
|
Result:=SearchLowUpCase(FN+'.pp');
|
||||||
|
if Result='' then
|
||||||
|
Result:=SearchLowUpCase(FN+'.pas');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// file name is relative
|
// file name is relative
|
||||||
// search in include path
|
// search in include path
|
||||||
I:=0;
|
Result:=FindInPath(FN);
|
||||||
While (Result='') and (I<FIncludePaths.Count) do
|
// No extension, try default extensions
|
||||||
|
if (Result='') and (ExtractFileExt(FN)='') then
|
||||||
begin
|
begin
|
||||||
Result:=SearchLowUpCase(FIncludePaths[i]+AName);
|
Result:=FindInPath(FN+'.inc');
|
||||||
Inc(I);
|
if Result='' then
|
||||||
|
begin
|
||||||
|
Result:=FindInPath(FN+'.pp');
|
||||||
|
if Result='' then
|
||||||
|
Result:=FindInPath(FN+'.pas');
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
// search in BaseDirectory
|
|
||||||
if (Result='') and (BaseDirectory<>'') then
|
|
||||||
Result:=SearchLowUpCase(BaseDirectory+AName);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user