11402 Save copy of project file to a backup database when saving project file

This commit is contained in:
Magne Sjaastad
2024-05-01 09:46:22 +02:00
committed by GitHub
parent 3cd80f0871
commit 4617bcc673
10 changed files with 220 additions and 11 deletions

View File

@@ -24,6 +24,8 @@
#include "RiaFieldHandleTools.h"
#include "RiaFilePathTools.h"
#include "RiaGuiApplication.h"
#include "RiaPreferences.h"
#include "RiaProjectBackupTools.h"
#include "RiaProjectFileVersionTools.h"
#include "RiaTextStringTools.h"
#include "RiaVersionInfo.h"
@@ -405,10 +407,22 @@ RimMainPlotCollection* RimProject::mainPlotCollection() const
bool RimProject::writeProjectFile()
{
transferPathsToGlobalPathList();
bool couldOpenFile = writeFile();
QFile xmlFile( fileName );
if ( !xmlFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) return false;
QString content = documentAsString();
xmlFile.write( content.toUtf8() );
if ( RiaPreferences::current()->storeBackupOfProjectFiles() )
{
QString backupFilename = fileName + "db";
RiaProjectBackupTools::appendTextToDatabase( backupFilename, content );
}
distributePathsFromGlobalPathList();
return couldOpenFile;
return true;
}
//--------------------------------------------------------------------------------------------------