added warning in console if TeX sdk not installed

This commit is contained in:
s5260822 2025-03-22 22:55:28 +01:00
parent edb91b7b72
commit 76951476ef
3 changed files with 25 additions and 0 deletions

View file

@ -21,6 +21,7 @@ import java.util.concurrent.TimeUnit;
import static java.lang.Boolean.FALSE;
import static java.lang.Boolean.TRUE;
import static org.texttechnologylab.project.gruppe_05_1.export.TeXUtil.isTeXSdkInstalled;
import static org.texttechnologylab.project.gruppe_05_1.util.PPRUtils.checkAndProcessNewProtocols;
public class Main {
@ -61,6 +62,12 @@ public class Main {
System.out.println(" - Debug Logging: " + DEBUG_LOGGING);
System.out.println("--------------------------------------------o");
if (!isTeXSdkInstalled()) {
Logger.orange("-------------------------------------------------o");
Logger.orange("TeX SDK not installed. PDF export will not work.");
Logger.orange("-------------------------------------------------o");
}
if (ONLY_RUN_WEB) {
Logger.info("Starting Web Service...");
RESTHandler restHandler = new RESTHandler();

View file

@ -209,4 +209,18 @@ public class TeXUtil {
}
});
}
public static boolean isTeXSdkInstalled() {
try {
Process process = Runtime.getRuntime().exec("pdflatex --version");
BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
String s;
while ((s = stdInput.readLine()) != null) {
if (s.contains("pdfTeX")) {
return true;
}
}
} catch (IOException ignored) {}
return false;
}
}

View file

@ -28,4 +28,8 @@ public class Logger {
public static void pink(String message) {
System.out.println("\u001B[35m" + java.time.LocalTime.now() + " PINK: " + message + "\u001B[0m");
}
public static void orange(String message) {
System.out.println("\u001B[38;5;214m" + message + "\u001B[0m");
}
}