Vérification si le Bakefile existe

This commit is contained in:
Louay DARDOURI 2025-02-04 10:34:06 +01:00
parent 2d7f69f02e
commit 98e84fcdf9
2 changed files with 6 additions and 1 deletions
src/fr/monlouyan/bakefile
tests/test-02-existe-deja

@ -16,6 +16,11 @@ public class BakefileParser {
public List<Target> parse() {
List<Target> targets = new ArrayList<>();
if (!Files.exists(Paths.get(filename))) {
System.out.println("*** No targets specified and no makefile found. Stop.");
System.exit(1);
}
try {
List<String> lines = Files.readAllLines(Paths.get(filename));
for (String line : lines) {
@ -31,6 +36,6 @@ public class BakefileParser {
e.printStackTrace();
}
return targets;
}
}
}

BIN
tests/test-02-existe-deja/main Executable file

Binary file not shown.