support abs paths
This commit is contained in:
@ -35,11 +35,21 @@ public final class StupsCompiler {
|
|||||||
|
|
||||||
Lexer lexer;
|
Lexer lexer;
|
||||||
try {
|
try {
|
||||||
|
// Relativer Pfad
|
||||||
|
|
||||||
Path programPath = Paths.get(System.getProperty("user.dir") + "/" + filename);
|
Path programPath = Paths.get(System.getProperty("user.dir") + "/" + filename);
|
||||||
lexer = new StupsLexer(CharStreams.fromPath(programPath));
|
lexer = new StupsLexer(CharStreams.fromPath(programPath));
|
||||||
} catch (IOException e) {
|
} 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;
|
Grammar grammar;
|
||||||
|
|||||||
Reference in New Issue
Block a user