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 b218d9205..aa5538a40 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 3e4099bc6..54ddcd8c0 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 e8311cd2a..bea3beba9 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;