Skip to content

Commit a4cfbb1

Browse files
committedNov 12, 2013
[FEATURE] leave backup when saving projects
1 parent ee3870e commit a4cfbb1

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎src/core/qgsproject.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,15 @@ bool QgsProject::write()
936936
{
937937
clearError();
938938

939+
// Create backup file
940+
if ( QFile::exists( fileName() ) )
941+
{
942+
QString backup = fileName() + "~";
943+
if ( QFile::exists( backup ) )
944+
QFile::remove( backup );
945+
QFile::rename( fileName(), backup );
946+
}
947+
939948
// if we have problems creating or otherwise writing to the project file,
940949
// let's find out up front before we go through all the hand-waving
941950
// necessary to create all the Dom objects

0 commit comments

Comments
 (0)