in src/java/io/bazel/rulesscala/scalac/ScalacWorker.java [294:317]
private static void deleteRecursively(Path directory) throws IOException {
if (directory != null) {
Files.walkFileTree(
directory,
new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
if (isWindows) {
file.toFile().setWritable(true);
}
Files.delete(file);
return FileVisitResult.CONTINUE;
}
@Override
public FileVisitResult postVisitDirectory(Path dir, IOException exc)
throws IOException {
Files.delete(dir);
return FileVisitResult.CONTINUE;
}
});
}
}