diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 3636a18daf..279f399f87 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -1010,9 +1010,6 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta private void activeTemplate(FILE tplFile, JTemplate jt) { // 如果该模板已经打开,则进行激活就可以了 String fullName = StableUtils.pathJoin(new String[]{ProjectConstants.REPORTLETS_NAME, tplFile.getName()}); - if (tplFile instanceof FileNodeFILE) { - fullName = ((FileNodeFILE) tplFile).getEnvPath() + "/" + tplFile.getPath(); - } // 如果是从文件夹打开的文件,不是从设计器文件树打开的文件,则直接取path就行 if (tplFile instanceof FileFILE) { fullName = tplFile.getPath(); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index c683488e86..11edfcb830 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -49,6 +49,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.report.cell.Elem; import com.fr.report.cell.cellattr.CellImage; import com.fr.stable.ArrayUtils; +import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.core.UUID; @@ -199,7 +200,12 @@ public abstract class JTemplate> } public String getPath() { - return getEditingFILE().getPath(); + String editingFileName = getEditingFILE().getPath(); + if (OperatingSystem.isWindows()) { + return editingFileName.replaceAll("/", "\\\\"); + } else { + return editingFileName.replaceAll("\\\\", "/"); + } } protected abstract JComponent createCenterPane();