This is an automated email from the ASF dual-hosted git repository. jamesyong pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push: new 4b8dd2a Fixed: Open FTL File from browser (OFBIZ-12018) 4b8dd2a is described below commit 4b8dd2a06bb28bf14e350382432845143783b621 Author: James Yong <jamesy...@apache.org> AuthorDate: Fri Sep 25 22:44:46 2020 +0800 Fixed: Open FTL File from browser (OFBIZ-12018) Unable to open file in Windows Thanks Jacques for reporting. --- .../src/main/java/org/apache/ofbiz/common/CommonEvents.java | 6 ++++++ framework/widget/config/widget.properties | 8 ++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java index 6313fbf..b8b9a2e 100644 --- a/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java +++ b/framework/common/src/main/java/org/apache/ofbiz/common/CommonEvents.java @@ -25,6 +25,7 @@ import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; @@ -459,6 +460,11 @@ public class CommonEvents { // find absolute path of file URL sourceFileUrl = FlexibleLocation.resolveLocation(sourceLocation); String location = sourceFileUrl.getFile(); + // ensure file separator in location is correct + if (!location.contains(File.separator) && "\\".equals(File.separator)) { + location = location.replaceAll("/", "\\\\"); + } + location = "\"" + location + "\""; // prepare content map for string expansion Map<String, Object> sourceMap = new HashMap<>(); sourceMap.put("sourceLocation", location); diff --git a/framework/widget/config/widget.properties b/framework/widget/config/widget.properties index 8d7a446..dc1be2c 100644 --- a/framework/widget/config/widget.properties +++ b/framework/widget/config/widget.properties @@ -33,13 +33,9 @@ widget.verbose=true # SOURCE - Show named border with link to open the source code widget.dev.namedBorder=NONE -# Command template to open file with editor -# Linux: +# Command template to open file with editor. Make sure the program is in PATH. # idea ${sourceLocation} -# eclipse --launcher.openFile ${sourceLocation} -# Windows: -# idea.exe ${sourceLocation} -# eclipse.exe --launcher.openFile ${sourceLocation} +# eclipse ${sourceLocation} widget.dev.cmd.openSourceFile=idea ${sourceLocation} # Default number of items to be displayed per page in a list form