The name of the initial branch for new projects is now "main" instead of "master". Existing projects remain unchanged. More information: https://doku.lrz.de/display/PUBLIC/GitLab

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

fix util for recursive copy of test data

parent d9c671aa
...@@ -4,7 +4,6 @@ import org.vadere.util.io.RecursiveCopy; ...@@ -4,7 +4,6 @@ import org.vadere.util.io.RecursiveCopy;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
...@@ -12,18 +11,22 @@ import java.util.Comparator; ...@@ -12,18 +11,22 @@ import java.util.Comparator;
public class TestUtils { public class TestUtils {
public static void resetTestStructure(String dest, String backup) throws URISyntaxException { public static void copyDirTo(Path source, Path dest){
try { try {
if (Paths.get(dest).toFile().exists()) { if (dest.toFile().exists()) {
Files.walk(Paths.get(dest)) Files.walk(dest)
.sorted(Comparator.reverseOrder()) .sorted(Comparator.reverseOrder())
.map(Path::toFile) .map(Path::toFile)
.forEach(File::delete); .forEach(File::delete);
} }
Files.walkFileTree(Paths.get(backup), new RecursiveCopy(backup, dest)); Files.walkFileTree(source, new RecursiveCopy(source, dest));
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); 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