guzba / zippy

Pure Nim implementation of deflate, zlib, gzip and zip.
MIT License
246 stars 29 forks source link

write to destination directly instead of temp dir folder #26

Closed maradotwebp closed 3 years ago

maradotwebp commented 3 years ago

In ZipArchives, writes directly to destination instead of a temporary folder.

If the export fails during the process, the destination folder is deleted in order to not leave half finished exports (We're allowed to do that because we abort if the destination folder exists anyway, so no other files are getting deleted).

Fixes #25.

Difficult to write tests because issue only occurs on seperate partitions, but tested locally on both Windows and Linux.

maradotwebp commented 3 years ago

I've completely removed the code that creates a temp folder now. Tell me if I'm missing something, but IMO we can just remove the destination folder if export fails.

guzba commented 3 years ago

Thanks for the PR. I haven't been able to look at this yet but I will as soon as I can. Should be back to normal and able to look at this in a couple days.

maradotwebp commented 3 years ago

Have you been able to look at this yet?

guzba commented 3 years ago

(Finally) merged. Thanks for the PR!