Skip to content

Commit

Permalink
Fix Zipfile writing on Windows (#79)
Browse files Browse the repository at this point in the history
* Fix writing to zipfiles on Windows.
  • Loading branch information
bpepple authored Feb 29, 2024
1 parent 6d2d230 commit fa1fdd0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .idea/darkseid.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion darkseid/archivers/zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ def _rebuild(self: "ZipArchiver", exclude_list: list[str]) -> bool:
zout.writestr(item, buffer)

# replace with the new file
self.path.unlink()
self.path.unlink(missing_ok=True)
zout.close() # Required on Windows
shutil.move(cast(str, zout.filename), self.path)
return True
except (zipfile.BadZipfile, OSError) as e:
Expand Down

0 comments on commit fa1fdd0

Please sign in to comment.