mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 01:19:37 +02:00
IDE: less file stat calls
git-svn-id: trunk@46437 -
This commit is contained in:
parent
9fa0bd9a6f
commit
04b76a0df1
@ -903,7 +903,7 @@ begin
|
||||
// source is a program
|
||||
// either this is a lazarus project or it is not yet a lazarus project ;)
|
||||
LPIFilename:=ChangeFileExt(FFilename,'.lpi');
|
||||
if FileExistsUTF8(LPIFilename) then begin
|
||||
if FileExistsCached(LPIFilename) then begin
|
||||
if IDEQuestionDialog(lisProjectInfoFileDetected,
|
||||
Format(lisTheFileSeemsToBeTheProgramFileOfAnExistingLazarusP,
|
||||
[FFilename]), mtConfirmation,
|
||||
@ -1062,7 +1062,7 @@ begin
|
||||
|
||||
// check for special files
|
||||
if ([ofRegularFile,ofRevert,ofProjectLoading]*FFlags=[])
|
||||
and FilenameIsAbsolute(FFilename) and FileExistsUTF8(FFilename) then begin
|
||||
and FilenameIsAbsolute(FFilename) and FileExistsCached(FFilename) then begin
|
||||
// check if file is a lazarus project (.lpi)
|
||||
if (CompareFileExt(FFilename,'.lpi',false)=0) then
|
||||
begin
|
||||
@ -1126,7 +1126,8 @@ begin
|
||||
try
|
||||
|
||||
// check if file exists
|
||||
if FilenameIsAbsolute(FFilename) and (not FileExistsUTF8(FFilename)) then begin
|
||||
if FilenameIsAbsolute(FFilename) and (not FileExistsCached(FFilename)) then
|
||||
begin
|
||||
// file does not exist
|
||||
if (ofRevert in FFlags) then begin
|
||||
// PrepareRevert failed, due to missing file
|
||||
@ -1151,7 +1152,7 @@ begin
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// check readonly
|
||||
FNewUnitInfo.FileReadOnly:=FileExistsUTF8(FNewUnitInfo.Filename)
|
||||
FNewUnitInfo.FileReadOnly:=FileExistsCached(FNewUnitInfo.Filename)
|
||||
and (not FileIsWritable(FNewUnitInfo.Filename));
|
||||
//debugln('[TFileOpener.OpenEditorFile] B');
|
||||
// open file in source notebook
|
||||
@ -1190,7 +1191,7 @@ var TempFile,TempPath,CurPath: String;
|
||||
FinalFile: String;
|
||||
begin
|
||||
FinalFile:=ExpandFileNameUTF8(CurPath+TempFile+Ext);
|
||||
Result:=FileExistsUTF8(FinalFile);
|
||||
Result:=FileExistsCached(FinalFile);
|
||||
if Result then
|
||||
FFileName:=FinalFile;
|
||||
end;
|
||||
@ -1307,7 +1308,7 @@ begin
|
||||
|
||||
// check if absolute FFileName
|
||||
if FilenameIsAbsolute(FFileName) then begin
|
||||
if FileExistsUTF8(FFileName) then
|
||||
if FileExistsCached(FFileName) then
|
||||
Found:=true
|
||||
else
|
||||
exit;
|
||||
@ -2809,7 +2810,7 @@ begin
|
||||
TempCmd:=CmdAfterExe;
|
||||
if not FilenameIsAbsolute(TempCmd) then
|
||||
TempCmd:=TrimFilename(AppendPathDelim(Project1.ProjectDirectory)+TempCmd);
|
||||
if FileExistsUTF8(TempCmd) then begin
|
||||
if FileExistsCached(TempCmd) then begin
|
||||
CmdAfterExe:=TempCmd;
|
||||
end else begin
|
||||
TempCmd:=FindDefaultExecutablePath(CmdAfterExe);
|
||||
@ -3771,7 +3772,7 @@ begin
|
||||
AddRecentProjectFileToEnvironment(AFilename);
|
||||
end else begin
|
||||
// open failed
|
||||
if not FileExistsUTF8(AFilename) then begin
|
||||
if not FileExistsCached(AFilename) then begin
|
||||
EnvironmentOptions.RemoveFromRecentProjectFiles(AFilename);
|
||||
end else
|
||||
AddRecentProjectFileToEnvironment(AFilename);
|
||||
@ -3803,7 +3804,7 @@ begin
|
||||
// either this is a lazarus project
|
||||
// or it is not yet a lazarus project ;)
|
||||
LPIFilename:=ChangeFileExt(AFilename,'.lpi');
|
||||
if FileExistsUTF8(LPIFilename) then begin
|
||||
if FileExistsCached(LPIFilename) then begin
|
||||
if IDEQuestionDialog(lisProjectInfoFileDetected,
|
||||
Format(lisTheFileSeemsToBeTheProgramFileOfAnExistingLazarusP, [
|
||||
AFilename]), mtConfirmation, [mrOk,lisOpenProject2,mrCancel])<>mrOk
|
||||
@ -5373,7 +5374,7 @@ begin
|
||||
// try to find the pascal unit
|
||||
for i:=Low(PascalFileExt) to High(PascalFileExt) do begin
|
||||
UnitFilename:=ChangeFileExt(LFMUnitInfo.Filename,PascalFileExt[i]);
|
||||
if FileExistsUTF8(UnitFilename) then
|
||||
if FileExistsCached(UnitFilename) then
|
||||
break
|
||||
else
|
||||
UnitFilename:='';
|
||||
@ -7099,9 +7100,9 @@ begin
|
||||
and (not AnUnitInfo.IsVirtual) and FilenameIsPascalUnit(AnUnitInfo.Filename)
|
||||
then begin
|
||||
LFMFilename:=ChangeFileExt(AnUnitInfo.Filename,'.lfm');
|
||||
if not FileExistsUTF8(LFMFilename) then
|
||||
if not FileExistsCached(LFMFilename) then
|
||||
LFMFilename:=ChangeFileExt(AnUnitInfo.Filename,'.dfm');
|
||||
AnUnitInfo.HasResources:=FileExistsUTF8(LFMFilename);
|
||||
AnUnitInfo.HasResources:=FileExistsCached(LFMFilename);
|
||||
end;
|
||||
AnUnitInfo:=AnUnitInfo.NextPartOfProject;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user