IDE: using FileAgeCached

git-svn-id: trunk@24344 -
This commit is contained in:
mattias 2010-04-01 11:42:03 +00:00
parent 7906cc5720
commit a7a60cd4d3
6 changed files with 42 additions and 39 deletions

View File

@ -700,7 +700,7 @@ var
var
CurDate: LongInt;
begin
CurDate:=FileAgeUTF8(aFilename);
CurDate:=FileAgeCached(aFilename);
//DebugLn(['CheckFileAge ',aFilename,' ',CurDate]);
if (CurDate=-1) then exit;
if (MinPPUDate=-1) or (MinPPUDate>CurDate) then begin
@ -731,7 +731,7 @@ begin
Result:=mrCancel;
CompilerDate:=FileAgeUTF8(CompilerFilename);
CompilerDate:=FileAgeCached(CompilerFilename);
if CompilerDate=-1 then begin
Result:=MessageDlg(lisCCOErrorCaption,Format(lisCCOUnableToGetFileDate,[CompilerFilename]),
mtError,[mbIgnore,mbAbort],0);

View File

@ -34,7 +34,7 @@ uses
{$IFDEF IDE_MEM_CHECK}
MemCheck,
{$ENDIF}
Classes, SysUtils, Graphics, Controls, Forms, LCLProc, FileUtil, Dialogs,
Classes, SysUtils, Graphics, Controls, Forms, LCLProc, FileProcs, Dialogs,
Laz_XMLCfg, AvgLvlTree, ProjectIntf,
IDEProcs, LazarusIDEStrConsts, IDETranslations, LazConf,
ObjectInspector, IDEOptionDefs, IDEWindowIntf, ExtToolDialog, TransferMacros,
@ -1488,7 +1488,7 @@ end;
function TEnvironmentOptions.FileHasChangedOnDisk: boolean;
begin
Result:=FFileHasChangedOnDisk
or ((FFilename<>'') and (FFileAge<>0) and (FileAgeUTF8(FFilename)<>FFileAge));
or ((FFilename<>'') and (FFileAge<>0) and (FileAgeCached(FFilename)<>FFileAge));
FFileHasChangedOnDisk:=Result;
end;
@ -1512,7 +1512,7 @@ procedure TEnvironmentOptions.FileUpdated;
begin
FFileHasChangedOnDisk:=false;
if FFilename<>'' then
FFileAge:=FileAgeUTF8(FFilename)
FFileAge:=FileAgeCached(FFilename)
else
FFileAge:=0;
end;

View File

@ -31,7 +31,7 @@ interface
uses
Classes, SysUtils, GetText, LCLProc, Translations,
IDEProcs, FileUtil,
IDEProcs, FileProcs,
avl_tree, LazarusIDEStrConsts;
{ IDE Language (Human, not computer) }
@ -224,7 +224,7 @@ begin
//DebugLn(['ConvertPackageRSTFiles RSTFilename=',RSTFilename,' OutputFilename=',OutputFilename]);
if (not FileExistsUTF8(OutputFilename))
or (FileAgeUTF8(RSTFilename)>FileAgeUTF8(OutputFilename)) then
or (FileAgeCached(RSTFilename)>FileAgeCached(OutputFilename)) then
begin
FileList.Add(RSTFilename);
{$ifndef SinglePOFile}

View File

@ -35,7 +35,7 @@ unit InputHistory;
interface
uses
Classes, SysUtils, FileUtil, DiffPatch, IDEProcs, AvgLvlTree,
Classes, SysUtils, FileUtil, FileProcs, DiffPatch, IDEProcs, AvgLvlTree,
SynEditTypes, Laz_XMLCfg, LazConf, Dialogs, LCLProc;
{$ifdef Windows}
@ -851,8 +851,8 @@ begin
Clear;
FCompilerPath:=AValue;
ResolvedFilename:=ReadAllLinks(FCompilerPath,false);
if FileExistsUTF8(ResolvedFilename) then
FCompilerAge:=FileAgeUTF8(ResolvedFilename)
if FileExistsCached(ResolvedFilename) then
FCompilerAge:=FileAgeCached(ResolvedFilename)
else
FCompilerAge:=-1;
end;
@ -947,7 +947,7 @@ begin
if Result and CheckCompiler then begin
ResolvedFilename:=ReadAllLinks(FCompilerPath,false);
if FileExistsUTF8(ResolvedFilename)
and (FileAgeUTF8(ResolvedFilename)=FCompilerAge) then
and (FileAgeCached(ResolvedFilename)=FCompilerAge) then
exit;
FCompilerAge:=-1;
Result:=false;

View File

@ -59,13 +59,13 @@ uses
MemCheck,
{$ENDIF}
// fpc packages
Math, Classes, SysUtils, Process, AsyncProcess, TypInfo,
Math, Classes, SysUtils, Process, AsyncProcess, TypInfo, AVL_Tree,
// lcl
LCLProc, LCLMemManager, LCLType, LCLIntf, LConvEncoding, LMessages, ComCtrls,
LResources, StdCtrls, Forms, Buttons, Menus, FileUtil, Controls, GraphType,
FileUtil, LResources, StdCtrls, Forms, Buttons, Menus, Controls, GraphType,
HelpIntfs, Graphics, ExtCtrls, Dialogs, InterfaceBase, LDockCtrl, UTF8Process,
// codetools
CodeBeautifier, FindDeclarationTool, LinkScanner, BasicCodeTools, AVL_Tree,
FileProcs, CodeBeautifier, FindDeclarationTool, LinkScanner, BasicCodeTools,
Laz_XMLCfg, CodeToolsStructs, CodeToolManager, CodeCache, DefineTemplates,
// synedit
SynEditKeyCmds, SynBeautifier, SynEditMarks,
@ -3648,7 +3648,7 @@ begin
+lisAllFiles+'|'+GetAllFilesMask;
if OpenDialog.Execute then begin
AFilename:=ExpandFileNameUTF8(OpenDialog.Filename);
if CompareFileExt(AFilename,'.lpi')<>0 then begin
if FileUtil.CompareFileExt(AFilename,'.lpi')<>0 then begin
// not a lpi file
// check if it is a program source
@ -3828,7 +3828,7 @@ begin
POFileAgeValid:=false;
if FileExistsCached(POFilename) then begin
POFileAge:=FileAgeUTF8(POFilename);
POFileAge:=FileAgeCached(POFilename);
POFileAgeValid:=true;
end;
@ -3844,7 +3844,7 @@ begin
// check .lst file
LRTFilename:=ChangeFileExt(CurFilename,'.lrt');
if FileExistsCached(LRTFilename)
and ((not POFileAgeValid) or (FileAgeUTF8(LRTFilename)>POFileAge)) then
and ((not POFileAgeValid) or (FileAgeCached(LRTFilename)>POFileAge)) then
Files.Add(LRTFilename);
// check .rst file
RSTFilename:=ExtractFileName(ChangeFileExt(CurFilename,'.rst'));
@ -3859,7 +3859,7 @@ begin
//DebugLn(['TMainIDE.UpdateProjectPOFile Looking for .rst file ="',RSTFilename,'"']);
if FileExistsCached(RSTFilename)
and ((not POFileAgeValid) or (FileAgeUTF8(RSTFilename)>POFileAge)) then
and ((not POFileAgeValid) or (FileAgeCached(RSTFilename)>POFileAge)) then
Files.Add(RSTFilename);
end;
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
@ -9548,7 +9548,8 @@ begin
Ext:='.lpi';
end;
if (not FileIsText(AFilename,FileReadable)) and FileReadable then begin
if (not FileUtil.FileIsText(AFilename,FileReadable)) and FileReadable then
begin
ACaption:=lisFileNotText;
AText:=Format(lisFileDoesNotLookLikeATextFileOpenItAnyway, ['"', AFilename,
'"', #13, #13]);
@ -10113,7 +10114,7 @@ begin
or (AProject.LastCompilerParams<>CompilerParams)
or ((AProject.LastCompilerFileDate>0)
and FileExistsCached(CompilerFilename)
and (FileAgeUTF8(CompilerFilename)<>AProject.LastCompilerFileDate))
and (FileAgeCached(CompilerFilename)<>AProject.LastCompilerFileDate))
then
NeedBuildAllFlag:=true;
@ -10126,10 +10127,10 @@ begin
exit(mrYes);
end;
StateFileAge:=FileAgeUTF8(StateFilename);
StateFileAge:=FileAgeCached(StateFilename);
// check main source file
if FileExistsUTF8(SrcFilename) and (StateFileAge<FileAgeUTF8(SrcFilename)) then
if FileExistsCached(SrcFilename) and (StateFileAge<FileAgeCached(SrcFilename)) then
begin
DebugLn('TMainIDE.CheckIfProjectNeedsCompilation SrcFile outdated ',AProject.IDAsString);
exit(mrYes);
@ -10147,7 +10148,7 @@ begin
DebugLn(' File="',CompilerFilename,'"');
exit(mrYes);
end;
if FileAgeUTF8(CompilerFilename)<>AProject.LastCompilerFileDate then begin
if FileAgeCached(CompilerFilename)<>AProject.LastCompilerFileDate then begin
DebugLn('TMainIDE.CheckIfProjectNeedsCompilation Compiler file changed for ',AProject.IDAsString);
DebugLn(' File="',CompilerFilename,'"');
exit(mrYes);
@ -10171,8 +10172,8 @@ begin
// check project files
AnUnitInfo:=AProject.FirstPartOfProject;
while AnUnitInfo<>nil do begin
if FileExistsUTF8(AnUnitInfo.Filename)
and (StateFileAge<FileAgeUTF8(AnUnitInfo.Filename)) then begin
if FileExistsCached(AnUnitInfo.Filename)
and (StateFileAge<FileAgeCached(AnUnitInfo.Filename)) then begin
DebugLn('TMainIDE.CheckIfProjectNeedsCompilation Src has changed ',AProject.IDAsString,' ',AnUnitInfo.Filename);
exit(mrYes);
end;
@ -10183,8 +10184,8 @@ begin
AnUnitInfo:=AProject.FirstUnitWithEditorIndex;
while AnUnitInfo<>nil do begin
if (not AnUnitInfo.IsPartOfProject)
and FileExistsUTF8(AnUnitInfo.Filename)
and (StateFileAge<FileAgeUTF8(AnUnitInfo.Filename)) then begin
and FileExistsCached(AnUnitInfo.Filename)
and (StateFileAge<FileAgeCached(AnUnitInfo.Filename)) then begin
DebugLn('TMainIDE.CheckIfProjectNeedsCompilation Editor Src has changed ',AProject.IDAsString,' ',AnUnitInfo.Filename);
exit(mrYes);
end;
@ -10524,7 +10525,7 @@ begin
// save state, so that next time the project is not compiled clean
Project1.LastCompilerFilename:=CompilerFilename;
Project1.LastCompilerParams:=CompilerParams;
Project1.LastCompilerFileDate:=FileAgeUTF8(CompilerFilename);
Project1.LastCompilerFileDate:=FileAgeCached(CompilerFilename);
DoJumpToCompilerMessage(-1,true);
CompileProgress.Ready(lisInfoBuildError);
exit;
@ -12568,7 +12569,7 @@ var
SearchFile:=AFilename;
SearchPath:=AllIncPaths;
Result:=SearchFileInPath(SearchFile,BaseDir,SearchPath,';',[]);
Result:=FileUtil.SearchFileInPath(SearchFile,BaseDir,SearchPath,';',[]);
{$IFDEF VerboseFindSourceFile}
debugln(['TMainIDE.SearchIndirectIncludeFile Result="',Result,'"']);
{$ENDIF}
@ -12583,7 +12584,7 @@ var
Filename:='';
SearchPath:=RemoveSearchPaths(TheSearchPath,AlreadySearchedPaths);
if SearchPath<>'' then begin
Filename:=SearchFileInPath(SearchFile,BaseDir,SearchPath,';',[]);
Filename:=FileUtil.SearchFileInPath(SearchFile,BaseDir,SearchPath,';',[]);
{$IFDEF VerboseFindSourceFile}
debugln(['TMainIDE.FindSourceFile trying "',SearchPath,'" Filename="',Filename,'"']);
{$ENDIF}

View File

@ -49,8 +49,10 @@ uses
MemCheck,
{$ENDIF}
Classes, SysUtils, TypInfo, FPCAdds, LCLProc, LCLIntf, LCLType, Forms,
Controls, Dialogs, InterfaceBase,
Laz_XMLCfg, ExprEval, FileUtil, DefineTemplates, CodeToolManager, CodeCache, ProjectIntf, MacroIntf, LazIDEIntf,
FileUtil, Controls, Dialogs, InterfaceBase,
Laz_XMLCfg, ExprEval, FileProcs, DefineTemplates, CodeToolManager, CodeCache,
// IDEIntf
ProjectIntf, MacroIntf, LazIDEIntf,
// IDE
CompOptsModes, ProjectResources, LazConf, frmCustomApplicationOptions,
LazarusIDEStrConsts, CompilerOptions,
@ -2631,7 +2633,7 @@ begin
if CompareFilenames(ProjectInfoFile,xmlconfig.Filename)=0 then begin
fProjectInfoFileBuffer:=CodeToolBoss.LoadFile(ProjectInfoFile,true,true);
try
fProjectInfoFileDate:=FileAgeUTF8(ProjectInfoFile);
fProjectInfoFileDate:=FileAgeCached(ProjectInfoFile);
except
end;
end;
@ -2965,7 +2967,7 @@ begin
ProjectInfoFile:=NewProjectInfoFile;
fProjectInfoFileBuffer:=CodeToolBoss.LoadFile(ProjectInfoFile,true,true);
try
fProjectInfoFileDate:=FileAgeUTF8(ProjectInfoFile);
fProjectInfoFileDate:=FileAgeCached(ProjectInfoFile);
{$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject A reading lpi');{$ENDIF}
if fProjectInfoFileBuffer=nil then
xmlconfig := TXMLConfig.CreateClean(ProjectInfoFile)
@ -4052,7 +4054,7 @@ begin
end;
if not FileExistsCached(ProjectInfoFile) then exit;
if fProjectInfoFileDate=FileAgeUTF8(ProjectInfoFile) then exit;
if fProjectInfoFileDate=FileAgeCached(ProjectInfoFile) then exit;
//DebugLn(['TProject.HasProjectInfoFileChangedOnDisk ',ProjectInfoFile,' fProjectInfoFileDate=',fProjectInfoFileDate,' ',FileAgeUTF8(ProjectInfoFile)]);
Result:=true;
@ -4060,7 +4062,7 @@ end;
procedure TProject.IgnoreProjectInfoFileOnDisk;
begin
fProjectInfoFileDate:=FileAgeUTF8(ProjectInfoFile);
fProjectInfoFileDate:=FileAgeCached(ProjectInfoFile);
end;
function TProject.FindDependencyByName(const PackageName: string
@ -4550,7 +4552,7 @@ begin
end;
// read the state file
CurStateFileAge:=FileAgeUTF8(StateFile);
CurStateFileAge:=FileAgeCached(StateFile);
if (not (lpsfStateFileLoaded in StateFlags))
or (StateFileDate<>CurStateFileAge) then
begin
@ -4593,7 +4595,7 @@ var
begin
StateFile:=GetStateFilename;
try
CompilerFileDate:=FileAgeUTF8(CompilerFilename);
CompilerFileDate:=FileAgeCached(CompilerFilename);
XMLConfig:=TXMLConfig.CreateClean(StateFile);
try
XMLConfig.SetValue('Compiler/Value',CompilerFilename);
@ -4607,7 +4609,7 @@ begin
LastCompilerFilename:=CompilerFilename;
LastCompilerFileDate:=CompilerFileDate;
LastCompilerParams:=CompilerParams;
StateFileDate:=FileAgeUTF8(StateFile);
StateFileDate:=FileAgeCached(StateFile);
StateFlags:=StateFlags+[lpsfStateFileLoaded];
except
on E: Exception do begin