IDE: check if project info file is a lpi file and allow to abort

git-svn-id: trunk@22951 -
This commit is contained in:
mattias 2009-12-03 22:19:32 +00:00
parent 79fd904fdf
commit 0b3d343290
2 changed files with 13 additions and 2 deletions

View File

@ -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';

View File

@ -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(