Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Commit

Permalink
[BUG] 修复没有添加目录到 JAR ENTRY 的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
4ra1n committed Jul 10, 2024
1 parent 34704b9 commit 920010e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

更新日志:

- todo
- [BUG] 修复没有添加目录到 `JAR ENTRY` 的问题

感谢以下用户的贡献:

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/me/n1ar4/jar/obfuscator/utils/DirUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ public static void zip(String sourceDir, String outputZip) throws IOException {
public static void addToZip(File source, ZipOutputStream jos, String parentDir) throws IOException {
if (source.isDirectory()) {
String dirPath = parentDir + source.getName() + "/";
ZipEntry entry = new ZipEntry(dirPath);
jos.putNextEntry(entry);
jos.closeEntry();
for (File file : Objects.requireNonNull(source.listFiles())) {
addToZip(file, jos, dirPath);
}
Expand Down

0 comments on commit 920010e

Please sign in to comment.