Fix FreeCAD#19588
This commit is contained in:
committed by
Benjamin Nauck
parent
ae08c322b2
commit
756e3789ce
@@ -2186,6 +2186,7 @@ bool Document::saveToFile(const char* filename) const
|
||||
// open extra scope to close ZipWriter properly
|
||||
{
|
||||
Base::ofstream file(tmp, std::ios::out | std::ios::binary);
|
||||
|
||||
Base::ZipWriter writer(file);
|
||||
if (!file.is_open()) {
|
||||
throw Base::FileException("Failed to open file", tmp);
|
||||
@@ -2211,9 +2212,12 @@ bool Document::saveToFile(const char* filename) const
|
||||
|
||||
// write additional files
|
||||
writer.writeFiles();
|
||||
|
||||
if (writer.hasErrors()) {
|
||||
throw Base::FileException("Failed to write all data to file", tmp);
|
||||
// retrieve Writer error strings
|
||||
std::stringstream message;
|
||||
message << "Failed to write all data to file ";
|
||||
message << writer.getErrors().front();
|
||||
throw Base::FileException(message.str().c_str(), tmp);
|
||||
}
|
||||
|
||||
GetApplication().signalSaveDocument(*this);
|
||||
|
||||
Reference in New Issue
Block a user