From 6e15fb58d1530c5dc28be872f950b2d5758246f8 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期日, 27 十一月 2022 08:50:48 +0800
Subject: [PATCH] 1

---
 src/main/java/com/lf/server/helper/ZipHelper.java |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/com/lf/server/helper/ZipHelper.java b/src/main/java/com/lf/server/helper/ZipHelper.java
index 3f1f8fa..9522053 100644
--- a/src/main/java/com/lf/server/helper/ZipHelper.java
+++ b/src/main/java/com/lf/server/helper/ZipHelper.java
@@ -30,9 +30,13 @@
     public static boolean unzip(String filePath, String zipDir) {
         ZipFile zipFile = null;
         try {
+            File dir = new File(zipDir);
+            if (!dir.exists() || !dir.isDirectory()) {
+                dir.mkdirs();
+            }
+
             int count;
             zipFile = new ZipFile(filePath);
-
             Enumeration e = zipFile.entries();
             while (e.hasMoreElements()) {
                 ZipEntry entry = (ZipEntry) e.nextElement();
@@ -47,7 +51,6 @@
                 BufferedInputStream is = new BufferedInputStream(zipFile.getInputStream(entry));
                 FileOutputStream fos = new FileOutputStream(zipDir + File.separator + entry.getName());
                 BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER_SIZE);
-
                 while ((count = is.read(BUFFER, 0, BUFFER_SIZE)) != -1) {
                     dest.write(BUFFER, 0, count);
                 }

--
Gitblit v1.9.3