package io.qameta.allure.util;

import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.attribute.BasicFileAttributes;

/**
 * Visitor that recursive copies directories.
 *
 * @since 2.0
 */
public class CopyVisitor extends SimpleFileVisitor<Path> {

    private final Path sourceDirectory;

    private final Path outputDirectory;

    public CopyVisitor(final Path sourceDirectory, final Path outputDirectory) {
        this.sourceDirectory = sourceDirectory;
        this.outputDirectory = outputDirectory;
    }

    @Override
    public FileVisitResult preVisitDirectory(final Path dir, final BasicFileAttributes attrs) throws IOException {
        Files.createDirectories(dir);
        return FileVisitResult.CONTINUE;
    }

    @Override
    public FileVisitResult visitFile(final Path file, final BasicFileAttributes attrs) throws IOException {
        final Path dest = outputDirectory.resolve(sourceDirectory.relativize(file));
        Files.copy(file, dest, StandardCopyOption.REPLACE_EXISTING);
        return FileVisitResult.CONTINUE;
    }
}

@@ -25,16 +25,74 @@
 .util;%0A%0A
+import org.slf4j.Logger;%0Aimport org.slf4j.LoggerFactory;%0A%0A
 import j
@@ -469,16 +469,102 @@
 ath%3E %7B%0A%0A
+    private static final Logger LOGGER = LoggerFactory.getLogger(CopyVisitor.class);%0A%0A
     priv
@@ -942,32 +942,50 @@
 s IOException %7B%0A
+        try %7B%0A    
         Files.cr
@@ -1006,16 +1006,119 @@
 s(dir);%0A
+        %7D catch (IOException e) %7B%0A            LOGGER.error(%22Could not create directory%22, e);%0A        %7D%0A
         
@@ -1271,32 +1271,124 @@
 s IOException %7B%0A
+        if (Files.notExists(file)) %7B%0A            return FileVisitResult.CONTINUE;%0A        %7D%0A
         final Pa
@@ -1456,16 +1456,34 @@
 file));%0A
+        try %7B%0A    
         
@@ -1543,16 +1543,112 @@
 STING);%0A
+        %7D catch (IOException e) %7B%0A            LOGGER.error(%22Could not copy file%22, e);%0A        %7D%0A
         

fix copy visitor (fixes #535, via #541)