Removing some deprecated things

This commit is contained in:
Jindra Petřík
2023-10-01 18:21:38 +02:00
parent 66d5711b0d
commit 7e86723b2e
2 changed files with 18 additions and 23 deletions
@@ -39,7 +39,7 @@ public class GraphVizDotCommands {
return true;
}
private static void runCommand(String command) {
private static void runCommand(String[] command) {
try {
Process process = Runtime.getRuntime().exec(command);
BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));
@@ -52,12 +52,17 @@ public class GraphVizDotCommands {
}
}
private static boolean runDotCommand(String command) {
private static boolean runDotCommand(String[] command) {
String dotLocation = Configuration.graphVizDotLocation.get();
if (dotLocation.isEmpty() && !new File(dotLocation).exists()) {
return false;
}//
runCommand("\"" + dotLocation + "\" " + command);
String[] commandPlusDot = new String[command.length + 1];
commandPlusDot[0] = dotLocation;
for (int i = 0; i < command.length; i++) {
commandPlusDot[1 + i] = command[i];
}
runCommand(commandPlusDot);
return true;
}
@@ -68,8 +73,7 @@ public class GraphVizDotCommands {
PrintWriter pw = new PrintWriter(gvFile);
pw.println(text);
pw.close();
String extraParams = " -Nfontname=times-bold -Nfontsize=12";
if (!runDotCommand("-Tpng" + extraParams + " -o \"" + pngFile.getAbsolutePath() + "\" \"" + gvFile.getAbsolutePath() + "\"")) {
if (!runDotCommand(new String[]{"-Tpng", "-Nfontname=times-bold", "-Nfontsize=12", "-o", pngFile.getAbsolutePath(), gvFile.getAbsolutePath()})) {
gvFile.delete();
return null;
}