IDE: backup lpi after creating xml, just before writing to disk

git-svn-id: trunk@51367 -
This commit is contained in:
mattias 2016-01-21 11:36:25 +00:00
parent 38c894449e
commit 969c2998aa

View File

@ -1512,10 +1512,8 @@ var
ACaption:string;
AText:string;
begin
if fSource=nil then begin
Result:=mrOk;
exit;
end;
if fSource=nil then
exit(mrOK);
if Assigned(fOnFileBackup) then begin
Result:=fOnFileBackup(Filename);
if Result=mrAbort then exit;
@ -1540,10 +1538,8 @@ var
ACaption:string;
AText:string;
begin
if fSource=nil then begin
Result:=mrOk;
exit;
end;
if fSource=nil then
exit(mrOK);
if Assigned(fOnFileBackup) then begin
Result:=fOnFileBackup(AFilename);
if Result=mrAbort then exit;
@ -3188,6 +3184,14 @@ begin
OnSaveProjectInfo(Self,FXMLConfig,CurFlags);
end;
// backup
if Assigned(fOnFileBackup) then begin
if fOnFileBackup(FXMLConfig.Filename)=mrAbort then begin
debugln(['Error: (lazarus) [TProject.SaveToLPI] backup of "'+FXMLConfig.Filename+'" failed.']);
exit;
end;
end;
// save lpi to disk
//debugln(['TProject.WriteProject ',DbgSName(FXMLConfig),' FCfgFilename=',FCfgFilename]);
FXMLConfig.Flush;
@ -3330,12 +3334,6 @@ begin
end;
//debugln(['TProject.WriteProject WriteLPI=',WriteLPI,' WriteLPS=',WriteLPS,' Modifed=',Modified,' SessionModified=',SessionModified]);
// backup
if WriteLPI and Assigned(fOnFileBackup) then begin
Result:=fOnFileBackup(CfgFilename);
if Result=mrAbort then exit;
end;
// increase usage counters
UpdateUsageCounts(CfgFilename);
if WriteLPI then