Browse Source

依赖下载位置

master
Fangjie Hu 8 years ago
parent
commit
269d1d1210
  1. 2
      designer_base/src/com/fr/design/extra/PluginHelper.java
  2. 3
      designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java

2
designer_base/src/com/fr/design/extra/PluginHelper.java

@ -35,6 +35,8 @@ import java.util.concurrent.ExecutionException;
public class PluginHelper { public class PluginHelper {
private static final String TEMP_PATH = System.getProperty("user.dir") + "/tmp"; 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 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";
/** /**

3
designer_base/src/com/fr/design/extra/plugindependence/DownLoadDependenceUI.java

@ -166,6 +166,7 @@ public class DownLoadDependenceUI implements ActionListener {
/** /**
* 下载和安装不分开是因为本地如果只安装好了一个依赖下次就不需要重复下载了 * 下载和安装不分开是因为本地如果只安装好了一个依赖下次就不需要重复下载了
* 如果下载依赖后不安装则后面的插件会把前面的插件覆盖故而下载好了一个安装一个
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ -176,7 +177,7 @@ public class DownLoadDependenceUI implements ActionListener {
httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(dependenceUnit.getDependenceID())); httpClient = new HttpClient(SiteCenter.getInstance().acquireUrlByKind(dependenceUnit.getDependenceID()));
if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) { if (httpClient.getResponseCode() == HttpURLConnection.HTTP_OK) {
InputStream reader = httpClient.getResponseStream(); InputStream reader = httpClient.getResponseStream();
String temp = StableUtils.pathJoin(PluginHelper.DOWNLOAD_PATH, PluginHelper.TEMP_FILE); String temp = StableUtils.pathJoin(PluginHelper.DEPENDENCE_DOWNLOAD_PATH, PluginHelper.TEMP_FILE);
StableUtils.makesureFileExist(new File(temp)); StableUtils.makesureFileExist(new File(temp));
FileOutputStream writer = new FileOutputStream(temp); FileOutputStream writer = new FileOutputStream(temp);
byte[] buffer = new byte[PluginConstants.BYTES_NUM]; byte[] buffer = new byte[PluginConstants.BYTES_NUM];

Loading…
Cancel
Save