fix: unpackInternal bug

This commit is contained in:
yanghuanyu 2021-12-31 15:05:30 +08:00
parent 43282a3201
commit f0c75d4b3c

View File

@ -275,6 +275,14 @@ public class YJSPacker {
if (!parent.exists()) {
LOGGER.trace("create directory " + parent.getAbsolutePath() + ": " + parent.mkdirs());
}
if (!target.exists()) {
if (entry.isDirectory()) {
target.mkdirs();
} else {
target.createNewFile();
}
}
if (!entry.isDirectory()) {
FileOutputStream fout = new FileOutputStream(target);
for (int k; (k = zin.read(buff)) > 0; ) {
fout.write(buff, 0, k);
@ -282,6 +290,7 @@ public class YJSPacker {
fout.close();
zin.closeEntry();
}
}
zin.close();
} catch (Exception e) {
e.printStackTrace();