fix: unpackInternal bug

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

View File

@ -275,12 +275,21 @@ public class YJSPacker {
if (!parent.exists()) {
LOGGER.trace("create directory " + parent.getAbsolutePath() + ": " + parent.mkdirs());
}
FileOutputStream fout = new FileOutputStream(target);
for (int k; (k = zin.read(buff)) > 0; ) {
fout.write(buff, 0, k);
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);
}
fout.close();
zin.closeEntry();
}
fout.close();
zin.closeEntry();
}
zin.close();
} catch (Exception e) {