From a64c26bb361bfc9613a29bb89a1a53b7f20ce53b Mon Sep 17 00:00:00 2001 From: Fabien Tessier <fabien.tessier@telecom-paristech.fr> Date: Thu, 21 Dec 2017 15:43:25 +0100 Subject: [PATCH] Fix some bugs --- src/main/java/myutil/FileUtils.java | 11 +++++++---- .../JFrameInteractiveSimulation.java | 7 ++++--- src/main/java/ui/window/JFrameRequirementTable.java | 4 ++++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/myutil/FileUtils.java b/src/main/java/myutil/FileUtils.java index 5a120b797c..3d3b0f27bb 100755 --- a/src/main/java/myutil/FileUtils.java +++ b/src/main/java/myutil/FileUtils.java @@ -75,12 +75,15 @@ public class FileUtils extends org.apache.commons.io.FileUtils{ public static String getExtension(File f) { + return getExtension(f.getName()); + } + + public static String getExtension(String name) { String ext = ""; - String s = f.getName(); - int i = s.lastIndexOf('.'); + int i = name.lastIndexOf('.'); - if (i > 0 && i < s.length() - 1) { - ext = s.substring(i+1).toLowerCase(); + if (i > 0 && i < name.length() - 1) { + ext = name.substring(i+1).toLowerCase(); } return ext; } diff --git a/src/main/java/ui/interactivesimulation/JFrameInteractiveSimulation.java b/src/main/java/ui/interactivesimulation/JFrameInteractiveSimulation.java index b0163e7142..3bbcf132a3 100755 --- a/src/main/java/ui/interactivesimulation/JFrameInteractiveSimulation.java +++ b/src/main/java/ui/interactivesimulation/JFrameInteractiveSimulation.java @@ -2487,9 +2487,10 @@ public class JFrameInteractiveSimulation extends JFrame implements ActionListene else filename = directory + filename; } - - SpecConfigTTool.ExternalCommand1 = SpecConfigTTool.ExternalCommand1.replace(SpecConfigTTool.lastVCD, filename); - SpecConfigTTool.lastVCD = filename; + if ("vcd".equals(FileUtils.getExtension(filename))) { + SpecConfigTTool.ExternalCommand1 = SpecConfigTTool.ExternalCommand1.replace(SpecConfigTTool.lastVCD, filename); + SpecConfigTTool.lastVCD = filename; + } // DB: now useless check // if (param.length() >0) { diff --git a/src/main/java/ui/window/JFrameRequirementTable.java b/src/main/java/ui/window/JFrameRequirementTable.java index f75637f2d3..5c5a4fd820 100755 --- a/src/main/java/ui/window/JFrameRequirementTable.java +++ b/src/main/java/ui/window/JFrameRequirementTable.java @@ -253,9 +253,13 @@ public class JFrameRequirementTable extends JFrame implements ActionListener /*, String path; if (SpecConfigTTool.DocGenPath.length() > 0) { path = SpecConfigTTool.DocGenPath + "/"; + File dir = new File(path); + if (!dir.exists()) + dir.mkdirs(); } else { path = ""; } + path += DOC_GEN_NAME;//"tablereq.html"; try { -- GitLab