mirror of
https://github.com/wownero/i2p-zero.git
synced 2026-10-17 15:21:40 +02:00
fixed recursive folder copy code
This commit is contained in:
@@ -61,13 +61,22 @@ public class RouterWrapper {
|
||||
return router;
|
||||
}
|
||||
|
||||
public void copyFolderRecursively(Path src, Path dest) {
|
||||
public static void copyFolderRecursively(Path src, Path dest) {
|
||||
try {
|
||||
Files.walk(src).forEach(source -> {
|
||||
try { Files.copy(source, dest.resolve(src.relativize(source)), StandardCopyOption.REPLACE_EXISTING); } catch (Exception e) { throw new RuntimeException(e); }
|
||||
Files.walk(src).forEach(s -> {
|
||||
try {
|
||||
Path d = dest.resolve(src.relativize(s));
|
||||
if(Files.isDirectory(s)) {
|
||||
if(!Files.exists(d)) Files.createDirectory(d);
|
||||
return;
|
||||
}
|
||||
Files.copy(s, d);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user