From c9d783d61f76c34e20058d99937d4f800bd0049d Mon Sep 17 00:00:00 2001 From: kerry Date: Thu, 24 Jan 2019 17:12:44 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-13225=20=E7=A7=BB=E5=8A=A8=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=E8=84=9A=E6=9C=AC=E4=B8=8B=E8=BD=BD=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8temp?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/fr/design/extra/PluginConstants.java | 8 ++++---- .../main/java/com/fr/design/extra/WebViewDlgHelper.java | 7 ++++++- .../com/fr/van/chart/DownloadOnlineSourcesHelper.java | 2 ++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginConstants.java b/designer-base/src/main/java/com/fr/design/extra/PluginConstants.java index b218d9205b..aa5538a403 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginConstants.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginConstants.java @@ -1,14 +1,14 @@ package com.fr.design.extra; +import com.fr.stable.StableUtils; +import com.fr.workspace.WorkContext; + /** * Created by ibm on 2017/5/25. */ public class PluginConstants { public static final int BYTES_NUM = 1024; - private static final String TEMP_PATH = System.getProperty("user.dir") + "/tmp"; - public static final String DOWNLOAD_PATH = System.getProperty("user.dir") + "/download"; - //插件依赖的下载位置 - public static final String DEPENDENCE_DOWNLOAD_PATH = System.getProperty("user.dir") + "/download/dependence"; + public static final String DOWNLOAD_PATH = StableUtils.pathJoin(WorkContext.getCurrent().getPath() + "/cache"); public static final String TEMP_FILE = "temp.zip"; public static final String CONNECTION_404 = "404"; diff --git a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java index 3e4099bc62..54ddcd8c0e 100644 --- a/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java +++ b/designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java @@ -16,6 +16,7 @@ import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.PluginStoreConstants; import com.fr.plugin.PluginVerifyException; +import com.fr.stable.CommonUtils; import com.fr.stable.EnvChangedListener; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; @@ -280,7 +281,11 @@ public class WebViewDlgHelper { try { if (get()) { - IOUtils.unzip(new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)), installHome); + File scriptZip = new File(StableUtils.pathJoin(PluginConstants.DOWNLOAD_PATH, PluginConstants.TEMP_FILE)); + if(scriptZip.exists()){ + IOUtils.unzip(scriptZip, installHome); + CommonUtils.deleteFile(scriptZip); + } PluginStoreConstants.refreshProps(); // 下载完刷新一下版本号等 JOptionPane.showMessageDialog(null, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Plugin_Shop_Installed"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Tool_Tips"), JOptionPane.INFORMATION_MESSAGE); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java b/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java index e8311cd2a8..bea3beba9a 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java +++ b/designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java @@ -10,6 +10,7 @@ import com.fr.general.IOUtils; import com.fr.general.CloudCenter; import com.fr.general.http.HttpClient; import com.fr.plugin.chart.DownloadSourcesEvent; +import com.fr.stable.CommonUtils; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; @@ -140,6 +141,7 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent { if (result) { //安装文件 IOUtils.unZipFilesGBK(temp, StableUtils.pathJoin(WorkContext.getCurrent().getPath(), siteInfo.localDir)); + CommonUtils.deleteFile(file); } } else { result = false;