Skip to content

Commit

Permalink
GH-644: handle non-existing directory properly
Browse files Browse the repository at this point in the history
  • Loading branch information
tobHai committed Jun 22, 2024
1 parent c749de7 commit 0a2231c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,8 +533,13 @@ private ComponentView createComponentView(DiagramOptions options, @Nullable Appl

private void clearOutputFolder() {

try(Stream<Path> paths = Files.walk(Paths.get(options.outputFolder)).sorted(Comparator.reverseOrder())) {
paths.map(Path::toFile).forEach(File::delete);
Path outputPath = Paths.get(options.outputFolder);
if (!outputPath.toFile().exists()) {
return;
}

try (Stream<Path> paths = Files.walk(outputPath)) {
paths.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
} catch (IOException o_O) {
throw new RuntimeException(o_O);
}
Expand Down

0 comments on commit 0a2231c

Please sign in to comment.