mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
11402 Save copy of project file to a backup database when saving project file
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user