From 3e839a54ecd4c862b6da947d9acb88ced4b766b0 Mon Sep 17 00:00:00 2001 From: hneemann Date: Tue, 20 Mar 2018 21:09:24 +0100 Subject: [PATCH] Added a better error message if ghdl is not installed. --- .../digital/core/extern/ApplicationGHDL.java | 20 ++++++++++++++++++- src/main/resources/lang/lang_de.xml | 3 +++ src/main/resources/lang/lang_en.xml | 3 +++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/neemann/digital/core/extern/ApplicationGHDL.java b/src/main/java/de/neemann/digital/core/extern/ApplicationGHDL.java index 7f2759ec6..5a290e004 100644 --- a/src/main/java/de/neemann/digital/core/extern/ApplicationGHDL.java +++ b/src/main/java/de/neemann/digital/core/extern/ApplicationGHDL.java @@ -9,6 +9,7 @@ import de.neemann.digital.core.element.Keys; import de.neemann.digital.core.extern.handler.ProcessInterface; import de.neemann.digital.core.extern.handler.StdIOInterface; import de.neemann.digital.gui.Settings; +import de.neemann.digital.lang.Lang; import java.io.File; import java.io.IOException; @@ -34,10 +35,22 @@ public class ApplicationGHDL extends ApplicationVHDLStdIO { } catch (IOException e) { if (file != null) ProcessStarter.removeFolder(file.getParentFile()); - throw e; + if (ghdlNotFound(e)) + throw new IOException(Lang.get("err_ghdlNotInstalled")); + else + throw e; } } + private boolean ghdlNotFound(Throwable e) { + while (e != null) { + if (e instanceof ProcessStarter.CouldNotStartProcessException) + return true; + e = e.getCause(); + } + return false; + } + @Override public boolean checkSupported() { return true; @@ -53,6 +66,11 @@ public class ApplicationGHDL extends ApplicationVHDLStdIO { String m1 = ProcessStarter.start(file.getParentFile(), ghdl, "-a", "--ieee=synopsys", file.getName()); String m2 = ProcessStarter.start(file.getParentFile(), ghdl, "-e", "--ieee=synopsys", "stdIOInterface"); return ProcessStarter.joinStrings(m1, m2); + } catch (IOException e) { + if (ghdlNotFound(e)) + throw new IOException(Lang.get("err_ghdlNotInstalled")); + else + throw e; } finally { if (file != null) ProcessStarter.removeFolder(file.getParentFile()); diff --git a/src/main/resources/lang/lang_de.xml b/src/main/resources/lang/lang_de.xml index a104f0508..98a294b18 100644 --- a/src/main/resources/lang/lang_de.xml +++ b/src/main/resources/lang/lang_de.xml @@ -880,6 +880,9 @@ Sind evtl. die Namen der Variablen nicht eindeutig? Wird eine externes Element mehrfach verwendet, muss der Code identisch sein! Konnte nicht auf stdOut schreiben: {0} + + Der VHDL Simulator ghdl scheint nicht installiert zu sein. Installieren Sie ghdl (http://ghdl.free.fr/) und versuchen Sie es erneut. Sollte es immer noch Probleme geben, überprüfen Sie den Pfad zur ausfühbaren ghdl-Datei in den Digital-Einstellungen. + Adress-Bits Anzahl der Adress-Bits, die verwendet werden. diff --git a/src/main/resources/lang/lang_en.xml b/src/main/resources/lang/lang_en.xml index 92569bad6..834e19ffc 100644 --- a/src/main/resources/lang/lang_en.xml +++ b/src/main/resources/lang/lang_en.xml @@ -875,6 +875,9 @@ If an external component is used multiple times, the code must be identical! Could not write to stdOut: {0} + + The VHDL simulator ghdl does not seem to be installed. Install ghdl (http://ghdl.free.fr/) and try again. If there are still problems, check the path to the ghdl executable in the Digital settings. + Address Bits Number of address bits used.