Browse Source

REPORT-9480 & REPORT-9159

master
Mata.Li 7 years ago
parent
commit
c99f35854f
  1. 17
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 4
      designer-base/src/main/java/com/fr/start/Demo.java

17
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -67,6 +67,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static final int MAX_SHOW_NUM = 10; private static final int MAX_SHOW_NUM = 10;
private static final String VERSION_80 = "80"; private static final String VERSION_80 = "80";
private static final int CACHINGTEMPLATE_LIMIT = 5; private static final int CACHINGTEMPLATE_LIMIT = 5;
private static final String WEB_NAME = "webapps";
private static DesignerEnvManager designerEnvManager; // gui. private static DesignerEnvManager designerEnvManager; // gui.
private String activationKey = null; private String activationKey = null;
@ -200,10 +201,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) { if (designerEnvManager == null || designerEnvManager.nameEnvMap.size() > 0) {
return; return;
} }
String installHome = StableUtils.getInstallHome(); String installHome = StableUtils.getInstallHome();
if (installHome != null && !".".equals(installHome)) { if (installHome != null && !".".equals(installHome)) {
String name = Inter.getLocText("FR-Engine_DEFAULT"); String name = Inter.getLocText("FR-Engine_DEFAULT");
String envPath = StableUtils.pathJoin(installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME); String envPath = designerEnvManager.getDefaultenvPath(installHome);
designerEnvManager.putEnv(name, LocalDesignerWorkspaceInfo.create(name, envPath)); designerEnvManager.putEnv(name, LocalDesignerWorkspaceInfo.create(name, envPath));
designerEnvManager.setCurEnvName(name); designerEnvManager.setCurEnvName(name);
} }
@ -486,8 +487,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
public boolean isCurrentEnvDefault() { public boolean isCurrentEnvDefault() {
DesignerWorkspaceInfo current = this.getWorkspaceInfo(curEnvName); DesignerWorkspaceInfo current = this.getWorkspaceInfo(curEnvName);
String defaultEnvPath = StableUtils.pathJoin(new String[]{StableUtils.getInstallHome(), ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME}); String defaultEnvPath = getDefaultenvPath(StableUtils.getInstallHome());
return ComparatorUtils.equals(new File(defaultEnvPath).getPath(), current.getPath()); return ComparatorUtils.equals(defaultEnvPath, current.getPath());
} }
/** /**
@ -495,7 +496,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/ */
public DesignerWorkspaceInfo getDefaultConfig() { public DesignerWorkspaceInfo getDefaultConfig() {
String installHome = StableUtils.getInstallHome(); String installHome = StableUtils.getInstallHome();
String defaultenvPath = StableUtils.pathJoin(installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME); String defaultenvPath = getDefaultenvPath(installHome);
defaultenvPath = new File(defaultenvPath).getPath(); defaultenvPath = new File(defaultenvPath).getPath();
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator(); Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator();
while (entryIt.hasNext()) { while (entryIt.hasNext()) {
@ -516,7 +517,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
*/ */
public String getDefaultEnvName() { public String getDefaultEnvName() {
String installHome = StableUtils.getInstallHome(); String installHome = StableUtils.getInstallHome();
String defaultenvPath = StableUtils.pathJoin(new String[]{installHome, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME}); String defaultenvPath = getDefaultenvPath(installHome);
defaultenvPath = new File(defaultenvPath).getPath(); defaultenvPath = new File(defaultenvPath).getPath();
if (nameEnvMap.size() >= 0) { if (nameEnvMap.size() >= 0) {
Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator(); Iterator<Entry<String, DesignerWorkspaceInfo>> entryIt = nameEnvMap.entrySet().iterator();
@ -531,6 +532,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
return Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"}); return Inter.getLocText(new String[]{"Default", "Utils-Report_Runtime_Env"});
} }
private String getDefaultenvPath(String installHome){
return StableUtils.pathJoin(installHome, WEB_NAME, ProjectConstants.WEBAPP_NAME, ProjectConstants.WEBINF_NAME);
}
/** /**
* 设置当前环境为默认 * 设置当前环境为默认
*/ */

4
designer-base/src/main/java/com/fr/start/Demo.java

@ -5,6 +5,7 @@ import com.fr.base.FRContext;
import com.fr.stable.OperatingSystem; import com.fr.stable.OperatingSystem;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import java.io.File;
import java.io.IOException; import java.io.IOException;
public class Demo { public class Demo {
@ -20,7 +21,8 @@ public class Demo {
if (OperatingSystem.isMacOS()) { if (OperatingSystem.isMacOS()) {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app"); executorPath = StableUtils.pathJoin(installHome, "bin", "designer.app");
} else { } else {
executorPath = StableUtils.pathJoin(installHome, "bin", "designer.exe demo"); //转成反斜杠格式
executorPath = new File(StableUtils.pathJoin(installHome, "bin", "designer.exe demo")).getPath();
} }
if (!new java.io.File(executorPath).exists()) { if (!new java.io.File(executorPath).exists()) {
FRContext.getLogger().error(executorPath + " can not be found."); FRContext.getLogger().error(executorPath + " can not be found.");

Loading…
Cancel
Save