Skip to content

Commit

Permalink
Fix project write error not reported on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Sep 1, 2023
1 parent bd4a6a1 commit 6848974
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion plugins/3MFWriter/ThreeMFWorkspaceWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode):

# Indicate that the 3mf mesh writer should not close the archive just yet (we still need to add stuff to it).
mesh_writer.setStoreArchive(True)
mesh_writer.write(stream, nodes, mode)
if not mesh_writer.write(stream, nodes, mode):
self.setInformation(mesh_writer.getInformation())
return False

archive = mesh_writer.getArchive()
if archive is None: # This happens if there was no mesh data to write.
Expand Down
4 changes: 2 additions & 2 deletions plugins/3MFWriter/ThreeMFWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ def write(self, stream, nodes, mode = MeshWriter.OutputMode.BinaryMode) -> bool:
archive.writestr(model_file, scene_string)
archive.writestr(content_types_file, b'<?xml version="1.0" encoding="UTF-8"?> \n' + ET.tostring(content_types))
archive.writestr(relations_file, b'<?xml version="1.0" encoding="UTF-8"?> \n' + ET.tostring(relations_element))
except Exception as e:
except Exception as error:
Logger.logException("e", "Error writing zip file")
self.setInformation(catalog.i18nc("@error:zip", "Error writing 3mf file."))
self.setInformation(str(error))
return False
finally:
if not self._store_archive:
Expand Down

0 comments on commit 6848974

Please sign in to comment.