Commit 9ad30ee2 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck

fix util for recursive copy of test data

parent d9c671aa
......@@ -4,7 +4,6 @@ import org.vadere.util.io.RecursiveCopy;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
......@@ -12,18 +11,22 @@ import java.util.Comparator;
public class TestUtils {
public static void resetTestStructure(String dest, String backup) throws URISyntaxException {
public static void copyDirTo(Path source, Path dest){
try {
if (Paths.get(dest).toFile().exists()) {
Files.walk(Paths.get(dest))
if (dest.toFile().exists()) {
Files.walk(dest)
.sorted(Comparator.reverseOrder())
.map(Path::toFile)
.forEach(File::delete);
}
Files.walkFileTree(Paths.get(backup), new RecursiveCopy(backup, dest));
Files.walkFileTree(source, new RecursiveCopy(source, dest));
} catch (IOException e) {
e.printStackTrace();
}
}
public static void copyDirTo(String dest, String backup) {
copyDirTo(Paths.get(dest), Paths.get(backup));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment