diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index a73626ad46..9df8da6e7e 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -583,6 +583,9 @@ resourcestring lisUnableToReadFile2 = 'Unable to read file %s%s%s!'; lisUnableToReadTheProjectInfoFile = 'Unable to read the project info file%s%' +'s%s%s.'; + lisStrangeLpiFile = 'Strange lpi file'; + lisTheFileDoesNotLookLikeALpiFile = 'The file %s does not look like a lpi ' + +'file.'; lisUnableToReadTheProjectInfoFile2 = 'Unable to read the project info file%' +'s%s%s%s.'; lisWriteError = 'Write Error'; diff --git a/ide/project.pp b/ide/project.pp index 73a90a30c3..7ed85cb7c2 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -2492,8 +2492,6 @@ begin try {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject A reading lpi');{$ENDIF} xmlconfig := TXMLConfig.Create(ProjectInfoFile); - fLastReadLPIFilename:=ProjectInfoFile; - fLastReadLPIFileDate:=Now; {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject B done lpi');{$ENDIF} except MessageDlg(Format(lisUnableToReadTheProjectInfoFile, [#13, '"', @@ -2503,6 +2501,9 @@ begin exit; end; + fLastReadLPIFilename:=ProjectInfoFile; + fLastReadLPIFileDate:=Now; + NewMainUnitID:=-1; try Path:='ProjectOptions/'; @@ -2512,6 +2513,13 @@ begin {$IFDEF IDE_MEM_CHECK}CheckHeapWrtMemCnt('TProject.ReadProject C reading values');{$ENDIF} FileVersion:= XMLConfig.GetValue(Path+'Version/Value',0); + if (Fileversion=0) and (xmlconfig.GetValue(Path+'Units/Count',0)=0) then + begin + if MessageDlg(lisStrangeLpiFile, + Format(lisTheFileDoesNotLookLikeALpiFile, [ProjectInfoFile]), + mtConfirmation,[mbIgnore,mbAbort],0)<>mrIgnore then exit; + end; + LoadFlags(XMLConfig,Path); SessionStorage:=StrToProjectSessionStorage(