package net.offbeatpioneer.intellij.plugins.grav.module.wizard;

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.attribute.BasicFileAttributes;

public class CopyFileVisitor extends SimpleFileVisitor<Path> {
    private final Path targetPath;
    private Path sourcePath = null;
    public CopyFileVisitor(Path targetPath) {
        this.targetPath = targetPath;
    }

    @Override
    public FileVisitResult preVisitDirectory(final Path dir,
                                             final BasicFileAttributes attrs) throws IOException {
        if (sourcePath == null) {
            sourcePath = dir;
        } else {
        Files.createDirectories(targetPath.resolve(sourcePath
                    .relativize(dir)));
        }
        return FileVisitResult.CONTINUE;
    }

    @Override
    public FileVisitResult visitFile(final Path file,
    final BasicFileAttributes attrs) throws IOException {
    Files.copy(file,
        targetPath.resolve(sourcePath.relativize(file)));
    return FileVisitResult.CONTINUE;
    }
}
@@ -111,118 +111,9 @@
 ile.
-FileVisitResult;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Path;%0Aimport java.nio.file.SimpleFileVisitor
+*
 ;%0Aim
@@ -297,16 +297,17 @@
 = null;%0A
+%0A
     publ
@@ -644,16 +644,20 @@
  else %7B%0A
+    
         
@@ -710,16 +710,16 @@
 rcePath%0A
-
         
@@ -872,24 +872,57 @@
  Path file,%0A
+                                 
     final Ba
@@ -963,24 +963,28 @@
 Exception %7B%0A
+    
     Files.co
@@ -1000,16 +1000,24 @@
         
+      
+  
 targetPa
@@ -1055,19 +1055,60 @@
 e(file))
-);%0A
+, StandardCopyOption.REPLACE_EXISTING);%0A    
     retu

replace existing files when creating project over an existing project