Browse Source

REPORT-13225 移动插件脚本下载位置,并删除无用temp文件

bugfix/10.0
kerry 6 years ago
parent
commit
c9d783d61f
  1. 8
      designer-base/src/main/java/com/fr/design/extra/PluginConstants.java
  2. 7
      designer-base/src/main/java/com/fr/design/extra/WebViewDlgHelper.java
  3. 2
      designer-chart/src/main/java/com/fr/van/chart/DownloadOnlineSourcesHelper.java

8
designer-base/src/main/java/com/fr/design/extra/PluginConstants.java

@ -1,14 +1,14 @@
package com.fr.design.extra; package com.fr.design.extra;
import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext;
/** /**
* Created by ibm on 2017/5/25. * Created by ibm on 2017/5/25.
*/ */
public class PluginConstants { public class PluginConstants {
public static final int BYTES_NUM = 1024; public static final int BYTES_NUM = 1024;
private static final String TEMP_PATH = System.getProperty("user.dir") + "/tmp"; public static final String DOWNLOAD_PATH = StableUtils.pathJoin(WorkContext.getCurrent().getPath() + "/cache");
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 TEMP_FILE = "temp.zip"; public static final String TEMP_FILE = "temp.zip";
public static final String CONNECTION_404 = "404"; public static final String CONNECTION_404 = "404";

7
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.log.FineLoggerFactory;
import com.fr.plugin.PluginStoreConstants; import com.fr.plugin.PluginStoreConstants;
import com.fr.plugin.PluginVerifyException; import com.fr.plugin.PluginVerifyException;
import com.fr.stable.CommonUtils;
import com.fr.stable.EnvChangedListener; import com.fr.stable.EnvChangedListener;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
@ -280,7 +281,11 @@ public class WebViewDlgHelper {
try { try {
if (get()) { 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(); // 下载完刷新一下版本号等 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); 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);
} }

2
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.CloudCenter;
import com.fr.general.http.HttpClient; import com.fr.general.http.HttpClient;
import com.fr.plugin.chart.DownloadSourcesEvent; import com.fr.plugin.chart.DownloadSourcesEvent;
import com.fr.stable.CommonUtils;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.workspace.WorkContext; import com.fr.workspace.WorkContext;
@ -140,6 +141,7 @@ public class DownloadOnlineSourcesHelper implements DownloadSourcesEvent {
if (result) { if (result) {
//安装文件 //安装文件
IOUtils.unZipFilesGBK(temp, StableUtils.pathJoin(WorkContext.getCurrent().getPath(), siteInfo.localDir)); IOUtils.unZipFilesGBK(temp, StableUtils.pathJoin(WorkContext.getCurrent().getPath(), siteInfo.localDir));
CommonUtils.deleteFile(file);
} }
} else { } else {
result = false; result = false;

Loading…
Cancel
Save