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

ZipFile.addFolder will delete the whole folder that already exist in zipfile #558

Open
zeroonead opened this issue Jul 30, 2024 · 1 comment

Comments

@zeroonead
Copy link

zeroonead commented Jul 30, 2024

Hello Sorry, English is not good. my zip4j version is 2.11.5, OS is windows 11, jdk 1.8,here is the code

ZipParameters zipParameters = new ZipParameters();  
zipParameters.setRootFolderNameInZip("lib");    
ZipFile zipFile = new ZipFile(apkPath);  
zipFile.addFolder(new File(myFolder), zipParameters);

the zipfile already exist the "lib" folder,some files like "lib/aa.txt" (the folder that i added did not have this files),but after zipFile.addFolder,the whole "lib" folder files was deleted, only the files that I added was lefted in zipfile.

what should I do to not delete the "lib" folder files that already exist in zipfile.

@zeroonead
Copy link
Author

I solve it by use addFiles instead of addFolder, like this

zipParameters.setRootFolderNameInZip("lib/arm64-v8a");
zipFile.addFiles(FileUtil.scanAllFile(myFolder, null), zipParameters);

is it a bug of addFolder?

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

1 participant