+ Fix for relative pathnames in include files, and code cleanup

This commit is contained in:
michael 2004-08-25 09:32:39 +00:00
parent abd581ac2b
commit 0576d558ce

View File

@ -374,7 +374,7 @@ end;
procedure TFileResolver.AddIncludePath(const APath: String); procedure TFileResolver.AddIncludePath(const APath: String);
begin begin
FIncludePaths.Add(IncludeTrailingPathDelimiter(APath)); FIncludePaths.Add(IncludeTrailingPathDelimiter(ExpandFileName(APath)));
end; end;
function TFileResolver.FindSourceFile(const AName: String): TLineReader; function TFileResolver.FindSourceFile(const AName: String): TLineReader;
@ -392,18 +392,27 @@ end;
function TFileResolver.FindIncludeFile(const AName: String): TLineReader; function TFileResolver.FindIncludeFile(const AName: String): TLineReader;
var var
i: Integer; i: Integer;
FN : String;
begin begin
Result := nil; Result := nil;
try If FileExists(AName) then
Result := TFileLineReader.Create(AName); Result := TFileLineReader.Create(AName)
except else
for i := 0 to FIncludePaths.Count - 1 do begin
try I:=0;
Result := TFileLineReader.Create(FIncludePaths[i] + AName); While (Result=Nil) and I<FIncludePaths.Count do
break; begin
Try
FN:=FIncludePaths[i]+AName;
If FileExists(FN) then
Result := TFileLineReader.Create(FN);
except except
Result:=Nil;
end; end;
end; Inc(I);
end;
end;
end; end;
@ -1026,7 +1035,10 @@ end.
{ {
$Log$ $Log$
Revision 1.7 2004-07-23 23:41:10 michael Revision 1.8 2004-08-25 09:32:39 michael
+ Fix for relative pathnames in include files, and code cleanup
Revision 1.7 2004/07/23 23:41:10 michael
+ Fixed scanning of strings with quotes in them + Fixed scanning of strings with quotes in them
Revision 1.6 2004/05/01 20:08:51 marco Revision 1.6 2004/05/01 20:08:51 marco
@ -1048,4 +1060,4 @@ end.
Revision 1.1 2003/03/13 21:47:42 sg Revision 1.1 2003/03/13 21:47:42 sg
* First version as part of FCL * First version as part of FCL
} }