فهرست منبع

BuildDirServiceImpl#eraseLocalRepo 方法中需要判断 dir 是否存在

reghao 2 ماه پیش
والد
کامیت
ee4483388c
1فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 4 2
      mgr/src/main/java/cn/reghao/devops/mgr/ops/build/service/impl/BuildDirServiceImpl.java

+ 4 - 2
mgr/src/main/java/cn/reghao/devops/mgr/ops/build/service/impl/BuildDirServiceImpl.java

@@ -98,8 +98,10 @@ public class BuildDirServiceImpl implements BuildDirService {
         String localRepo = LocalBuildDir.localRepo + File.separator + appId;
         File dir = new File(localRepo);
         try {
-            FileUtils.cleanDirectory(dir);
-        } catch (IOException e) {
+            if (dir.exists()) {
+                FileUtils.cleanDirectory(dir);
+            }
+        } catch (Exception e) {
             log.error("{}", e.getMessage());
         }
     }