Skip to content

Commit

Permalink
Abort save when unable to finish
Browse files Browse the repository at this point in the history
In these two cases, the project's file will not contain the latest
changes, so returning as if the save is complete is incorrect and can
lead to data loss (such as on app quit).
  • Loading branch information
heewa committed May 13, 2021
1 parent 91b0409 commit ccacf33
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/App/Document.cpp
Expand Up @@ -2398,8 +2398,8 @@ class BackupPolicy {

Base::FileInfo tmp(sourcename);
if (tmp.renameFile(targetname.c_str()) == false) {
Base::Console().Warning("Cannot rename file from '%s' to '%s'\n",
sourcename.c_str(), targetname.c_str());
throw Base::FileException(
"Cannot rename tmp save file to project file", targetname);
}
}
void applyTimeStamp(const std::string& sourcename, const std::string& targetname) {
Expand Down Expand Up @@ -2531,9 +2531,8 @@ class BackupPolicy {

Base::FileInfo tmp(sourcename);
if (tmp.renameFile(targetname.c_str()) == false) {
Base::Console().Error("Save interrupted: Cannot rename file from '%s' to '%s'\n",
sourcename.c_str(), targetname.c_str());
//throw Base::FileException("Save interrupted: Cannot rename temporary file to project file", tmp);
throw Base::FileException(
"Save interrupted: Cannot rename temporary file to project file", tmp);
}

if (numberOfFiles <= 0) {
Expand Down

0 comments on commit ccacf33

Please sign in to comment.