App: Abort save when unable to finish

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).
This commit is contained in:
Heewa Barfchin
2021-05-12 22:16:45 -04:00
parent 56ef4ee8bb
commit 5beedc6efd

View File

@@ -2398,8 +2398,8 @@ private:
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) {
@@ -2531,9 +2531,8 @@ private:
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) {