diff --git a/ide/checkcompileropts.pas b/ide/checkcompileropts.pas index aab34b766b..4f41b1dea4 100644 --- a/ide/checkcompileropts.pas +++ b/ide/checkcompileropts.pas @@ -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); diff --git a/ide/environmentopts.pp b/ide/environmentopts.pp index 5e569c4905..5186e2ec92 100644 --- a/ide/environmentopts.pp +++ b/ide/environmentopts.pp @@ -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; diff --git a/ide/idetranslations.pas b/ide/idetranslations.pas index ce3dfb96b6..82d1883045 100644 --- a/ide/idetranslations.pas +++ b/ide/idetranslations.pas @@ -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} diff --git a/ide/inputhistory.pas b/ide/inputhistory.pas index 4af287d5e3..8583dede50 100644 --- a/ide/inputhistory.pas +++ b/ide/inputhistory.pas @@ -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; diff --git a/ide/main.pp b/ide/main.pp index 0d3ab27448..45b62d00f5 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -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 (StateFileAgeAProject.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 (StateFileAgenil do begin if (not AnUnitInfo.IsPartOfProject) - and FileExistsUTF8(AnUnitInfo.Filename) - and (StateFileAge'' then begin - Filename:=SearchFileInPath(SearchFile,BaseDir,SearchPath,';',[]); + Filename:=FileUtil.SearchFileInPath(SearchFile,BaseDir,SearchPath,';',[]); {$IFDEF VerboseFindSourceFile} debugln(['TMainIDE.FindSourceFile trying "',SearchPath,'" Filename="',Filename,'"']); {$ENDIF} diff --git a/ide/project.pp b/ide/project.pp index 5fd129b236..64ca3996e2 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -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