in src/main/java/org/apache/netbeans/nbpackage/FileUtils.java [61:90]
public static void copyFiles(Path src, Path dst) throws IOException {
Files.walkFileTree(src, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
throws IOException {
Path targetDir = dst.resolve(src.relativize(dir));
try {
Files.copy(dir, targetDir);
ensureWritable(targetDir);
} catch (FileAlreadyExistsException ex) {
if (!Files.isDirectory(targetDir)) {
throw ex;
}
}
return CONTINUE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException {
Path targetFile = dst.resolve(src.relativize(file));
Files.copy(file, targetFile,
StandardCopyOption.COPY_ATTRIBUTES);
ensureWritable(targetFile);
return CONTINUE;
}
});
}