sets the ATF fitter envVar. see #100

This commit is contained in:
hneemann 2018-01-10 21:32:13 +01:00
parent b1ee388848
commit 83b5b966b5
4 changed files with 15 additions and 15 deletions

View File

@ -18,7 +18,6 @@ import java.util.concurrent.TimeUnit;
public class OSExecute {
private final ProcessBuilder procesBuilder;
private File workingDir;
/**
* Creates a new instance
@ -44,7 +43,17 @@ public class OSExecute {
* @param workingDir the working directory
*/
public void setWorkingDir(File workingDir) {
this.workingDir = workingDir;
procesBuilder.directory(workingDir);
}
/**
* Sets an environment variable
*
* @param key the key
* @param value the value
*/
public void setEnvVar(String key, String value) {
procesBuilder.environment().put(key, value);
}
/**
@ -54,10 +63,6 @@ public class OSExecute {
* @throws IOException IOException
*/
public String start() throws IOException {
if (workingDir != null)
procesBuilder.directory(workingDir);
procesBuilder.redirectErrorStream(true);
Process p = procesBuilder.start();
@ -79,7 +84,7 @@ public class OSExecute {
}
if (p.exitValue() != 0)
throw new IOException(Lang.get("err_processExitedWithError_N1_N2", p.exitValue(), "\n"+sr.toString()));
throw new IOException(Lang.get("err_processExitedWithError_N1_N2", p.exitValue(), "\n" + sr.toString()));
try {
sr.join();

View File

@ -49,20 +49,17 @@ public class StartATF150xFitter implements ExpressionToFileExporter.PostProcess
@Override
public File execute(File file) throws IOException {
final String tt2Path = file.getPath();
ArrayList<String> args = new ArrayList<>();
if (isLinux())
args.add("wine");
args.add(fitterExe.getPath());
args.add(tt2Path);
if (tt2Path.indexOf(' ') >= 0)
throw new IOException(Lang.get("err_whiteSpaceNotAllowedInTT2Path"));
args.add(file.getName());
try {
OSExecute execute = new OSExecute(args);
execute.setWorkingDir(fitterExe.getParentFile());
execute.setEnvVar("FITTERDIR", fitterExe.getParentFile().getPath());
execute.setWorkingDir(file.getParentFile());
String message = execute.start();

View File

@ -786,7 +786,6 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
<string name="err_constantsNotAllowed">Konstante Werte sind hier nicht erlaubt!</string>
<string name="err_invalidNumberFormat_N_N">Der String {0} ist keine Zahl (Pos {1})!</string>
<string name="err_invalidPinName_N">Der Name &quot;{0}&quot; ist nicht erlaubt!</string>
<string name="err_whiteSpaceNotAllowedInTT2Path">Im Pfad der TT2-Datei ist kein Leerzeichen erlaubt!</string>
<string name="key_AddrBits">Adress-Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM -->
<string name="key_AddrBits_tt">Anzahl der Adress-Bits, die verwendet werden.</string>

View File

@ -782,7 +782,6 @@ The names of the variables may not be unique.</string>
<string name="err_constantsNotAllowed">Constant values are not allowed!</string>
<string name="err_invalidNumberFormat_N_N">The string {0} is not a valid number (pos {1})!</string>
<string name="err_invalidPinName_N">The name &quot;{0}&quot; is not allowed!</string>
<string name="err_whiteSpaceNotAllowedInTT2Path">No white space is allowed in the path of the TT2 file!</string>
<string name="key_AddrBits">Address Bits</string><!-- ROM, RAMDualPort, RAMSinglePort, RAMSinglePortSel, EEPROM -->
<string name="key_AddrBits_tt">Number of address bits used.</string>