Zip
Zip copied to clipboard
Directories added twice, and empty zip created when only one subdirectory exists
I discovered a couple of errors while using the Zip library: (I'm using Xcode 8.0 (8A218a) and the Swift 2.3 version of Zip to compile a MacOS App)
Problem 1: When you zip a complete directory, it will include a complete extra copy of the directory in the zip file. Example: Directory Invoices:
- Subdirectory 2015 (20 files)
- Subdirectory 2016 (30 files)
When I would zip the directory Invoices it will make a zip file with the following structure:
- Subdirectory 2015 (20 files)
- Subdirectory 2016 (30 files)
- Subdirectory Invoices
- |- ----> Sub-directory 2015 (20 files)
- |- ----> Sub-directory 2016 (30 files)
Problem 2: When you zip a complete directory which only has one subfolder with files in it, Zip will create a 22 byte zip-file, which can't be read. Example: Directory Invoices:
- Subdirectory 2015 (20 files)
Please note: the directory invoices has no other files in it, just the subdirectory 2015. If it has at least one other file or directory, it will create a zip file, but with duplicated content like explained in Problem 1..
So, something goes wrong with the directory traversal.. I checked the code in zip-utilities, but couldn't really find a problem, so I think the problem is in the lower-level c files.
It would be really great if you could fix this, because the library is very handy!
P.S. After writing this I discovered Problem 1 seems to be a duplicate of https://github.com/marmelroy/Zip/issues/28 . Anyway, I think it's good to have the two problems listed together in one issue, because they seem related.