Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty subdirectories in the tree are also added as the top-level directory #781

Open
aschet opened this issue Apr 29, 2024 · 3 comments
Open

Comments

@aschet
Copy link

aschet commented Apr 29, 2024

I am currently trying to integrate ZIP compression with minizip-ng 4.0.5 into a Windows application (Windows 10 1809, Visual Studio 2022 17.9.6) and have noticed some unexpected behavior when it comes to empty subdirectories. When a directory tree is added recursively with mz_zip_writer_add_path, an additional top-level directory entry is created in the ZIP file for each empty subdirectory.

Directory tree example (no file extension means directory):

a.txt
b
b\c
b\d.txt

When compressing the example above with the implementation of minizip.c (-9 <OUT_DIR><OUT_FILE>.zip <IN_DIR>) this results in the following ZIP file content when displayed or extracted with the Windows Explorer or 7-Zip:

a.txt
b
c
b\c
b\d.txt
@nmoinvaz
Copy link
Member

This is intentional and a change in recent version.

@aschet
Copy link
Author

aschet commented Apr 30, 2024

This is intentional and a change in recent version.

Thank you for the clarification! I don't understand the rationale behind this decision, but it seems odd to me that due to this, directories during extraction will be created that were not part of the input directory tree. Is there any way to disable or work around this behavior (except for removing empty directories from the input)?

@nmoinvaz
Copy link
Member

I didn't see the c part in your second example. That looks like an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants