smihica / pyminizip

To create a password encrypted zip file in python.
Other
108 stars 38 forks source link

Fix _compress(): don't add slash on filepath if prefix is an empty st… #32

Closed veon82 closed 3 years ago

veon82 commented 4 years ago

Currently compress_multiple method allows adding all files in the root of the archive (second param set as an empty list) or adding files inside a specific folder (second param set as a list of paths).

This PR allows to use compress_multiple method in a hybrid scenario, that is archiving some files in the archive root (second param set as empty string at the corresponding list item) and other files in specific folders (second param set as folder path at the corresponding list item).

E.g.

pyminizip.compress_multiple(["/usr/tmp/a.txt", "/usr/tmp/b.txt"], ["", "testdir"], "/tmp/test.zip", None, 5)

Result:

smihica commented 3 years ago

good!

smihica commented 3 years ago

Thank you