IDE: fixed searching package files of default packages

git-svn-id: trunk@21700 -
This commit is contained in:
mattias 2009-09-14 14:33:40 +00:00
parent fc1071e18f
commit 2018344136
2 changed files with 23 additions and 4 deletions

View File

@ -602,6 +602,8 @@ type
FDefineTemplates: TLazPackageDefineTemplates; FDefineTemplates: TLazPackageDefineTemplates;
FDescription: string; FDescription: string;
FDirectory: string; FDirectory: string;
FDirectoryExpanded: string;
FDirectoryExpandedChangeStamp: integer;
FEnableI18N: boolean; FEnableI18N: boolean;
FFilename: string; FFilename: string;
FFileReadOnly: boolean; FFileReadOnly: boolean;
@ -644,6 +646,7 @@ type
function GetAutoIncrementVersionOnBuild: boolean; function GetAutoIncrementVersionOnBuild: boolean;
function GetComponentCount: integer; function GetComponentCount: integer;
function GetComponents(Index: integer): TPkgComponent; function GetComponents(Index: integer): TPkgComponent;
function GetDirectoryExpanded: string;
function GetRemovedCount: integer; function GetRemovedCount: integer;
function GetRemovedFiles(Index: integer): TPkgFile; function GetRemovedFiles(Index: integer): TPkgFile;
function GetFileCount: integer; function GetFileCount: integer;
@ -798,7 +801,8 @@ type
property DefineTemplates: TLazPackageDefineTemplates read FDefineTemplates property DefineTemplates: TLazPackageDefineTemplates read FDefineTemplates
write FDefineTemplates; write FDefineTemplates;
property Description: string read FDescription write SetDescription; property Description: string read FDescription write SetDescription;
property Directory: string read FDirectory; // the directory of the .lpk file property Directory: string read FDirectory; // the directory of the .lpk file with macros
property DirectoryExpanded: string read GetDirectoryExpanded;
property Editor: TBasePackageEditor read FPackageEditor property Editor: TBasePackageEditor read FPackageEditor
write SetPackageEditor; write SetPackageEditor;
property EnableI18N: Boolean read FEnableI18N write SetEnableI18N; property EnableI18N: Boolean read FEnableI18N write SetEnableI18N;
@ -2217,6 +2221,19 @@ begin
Result:=TPkgComponent(FComponents[Index]); Result:=TPkgComponent(FComponents[Index]);
end; end;
function TLazPackage.GetDirectoryExpanded: string;
begin
if (FDirectoryExpandedChangeStamp<>CompilerParseStamp) then begin
FDirectoryExpanded:=FDirectory;
// use default macros (not package macros)
if IDEMacros<>nil then
IDEMacros.SubstituteMacros(FDirectoryExpanded);
FDirectoryExpanded:=AppendPathDelim(TrimFilename(FDirectoryExpanded));
FDirectoryExpandedChangeStamp:=CompilerParseStamp;
end;
Result:=FDirectoryExpanded;
end;
function TLazPackage.GetRemovedCount: integer; function TLazPackage.GetRemovedCount: integer;
begin begin
Result:=FRemovedFiles.Count; Result:=FRemovedFiles.Count;
@ -2313,6 +2330,7 @@ begin
FDirectory:=FFilename FDirectory:=FFilename
else else
FDirectory:=ExtractFilePath(FFilename); FDirectory:=ExtractFilePath(FFilename);
FDirectoryExpandedChangeStamp:=InvalidParseStamp;
FHasDirectory:=(FDirectory<>'') and (FDirectory[length(FDirectory)]=PathDelim); FHasDirectory:=(FDirectory<>'') and (FDirectory[length(FDirectory)]=PathDelim);
FHasStaticDirectory:=FHasDirectory and FilenameIsAbsolute(FDirectory); FHasStaticDirectory:=FHasDirectory and FilenameIsAbsolute(FDirectory);
FUsageOptions.BaseDirectory:=FDirectory; FUsageOptions.BaseDirectory:=FDirectory;
@ -2536,6 +2554,7 @@ begin
FCompilerOptions.Clear; FCompilerOptions.Clear;
FDescription:=''; FDescription:='';
FDirectory:=''; FDirectory:='';
FDirectoryExpandedChangeStamp:=InvalidParseStamp;
FHasDirectory:=false; FHasDirectory:=false;
FHasStaticDirectory:=false; FHasStaticDirectory:=false;
FVersion.Clear; FVersion.Clear;
@ -2828,7 +2847,7 @@ var
CurPath: String; CurPath: String;
begin begin
if (not HasDirectory) then exit; if (not HasDirectory) then exit;
PkgDir:=FDirectory; PkgDir:=DirectoryExpanded;
if HasStaticDirectory and UseUp then if HasStaticDirectory and UseUp then
ExpandedFilename:=CreateRelativePath(ExpandedFilename,PkgDir) ExpandedFilename:=CreateRelativePath(ExpandedFilename,PkgDir)
else begin else begin
@ -2844,7 +2863,7 @@ procedure TLazPackage.LongenFilename(var AFilename: string);
begin begin
if not HasDirectory then exit; if not HasDirectory then exit;
if not FilenameIsAbsolute(AFilename) then if not FilenameIsAbsolute(AFilename) then
AFilename:=TrimFilename(Directory+AFilename); AFilename:=TrimFilename(DirectoryExpanded+AFilename);
end; end;
function TLazPackage.GetResolvedFilename: string; function TLazPackage.GetResolvedFilename: string;

View File

@ -3324,7 +3324,7 @@ begin
CurFilename:=AFilename; CurFilename:=AFilename;
APackage.ShortenFilename(CurFilename,true); APackage.ShortenFilename(CurFilename,true);
Result:=APackage.SearchShortFilename(CurFilename,SearchFlags); Result:=APackage.SearchShortFilename(CurFilename,SearchFlags);
//debugln(['TPkgManager.SearchFile Pkg=',APackage.Filename,' CurFilename="',CurFilename,'" ',Result<>nil]); //debugln(['TPkgManager.SearchFile Pkg=',APackage.Filename,' CurFilename="',CurFilename,'" Resul=',Result<>nil,' HasDirectory=',APackage.HasDirectory,' ExpFile=',APackage.DirectoryExpanded]);
if Result<>nil then exit; if Result<>nil then exit;
end; end;
end; end;