support abs paths

This commit is contained in:
ChUrl
2020-12-14 18:02:06 +01:00
parent 8ff6ffd637
commit de88d650d3

View File

@ -35,11 +35,21 @@ public final class StupsCompiler {
Lexer lexer;
try {
// Relativer Pfad
Path programPath = Paths.get(System.getProperty("user.dir") + "/" + filename);
lexer = new StupsLexer(CharStreams.fromPath(programPath));
} catch (IOException e) {
System.out.println("Das Programm konnte nicht gelesen werden.");
return;
try {
// Absoluter Pfad
Path programPath = Paths.get(filename);
lexer = new StupsLexer(CharStreams.fromPath(programPath));
} catch (IOException ee) {
System.out.println("Das Programm konnte nicht gelesen werden.");
return;
}
}
Grammar grammar;