From 920010e40b829c52c5ee797558f2eb6bb80e22b7 Mon Sep 17 00:00:00 2001 From: 4ra1n <2023503307@qq.com> Date: Wed, 10 Jul 2024 11:23:35 +0800 Subject: [PATCH] =?UTF-8?q?[BUG]=20=E4=BF=AE=E5=A4=8D=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=9B=AE=E5=BD=95=E5=88=B0=20`JAR=20ENTRY`?= =?UTF-8?q?=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.MD | 2 +- src/main/java/me/n1ar4/jar/obfuscator/utils/DirUtil.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.MD b/CHANGELOG.MD index 914bfb0..a835132 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -4,7 +4,7 @@ 更新日志: -- todo +- [BUG] 修复没有添加目录到 `JAR ENTRY` 的问题 感谢以下用户的贡献: diff --git a/src/main/java/me/n1ar4/jar/obfuscator/utils/DirUtil.java b/src/main/java/me/n1ar4/jar/obfuscator/utils/DirUtil.java index eac3f6b..d777292 100644 --- a/src/main/java/me/n1ar4/jar/obfuscator/utils/DirUtil.java +++ b/src/main/java/me/n1ar4/jar/obfuscator/utils/DirUtil.java @@ -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); }