Minor and tweaked refactoring from
by Andrew Shcheglov
(ashcheglov on GitHub).
@@ -226,9 +226,10 @@ public static PathCounters cleanDirectory(final Path directory, final DeleteOpti
*/
public static PathCounters copyDirectory(final Path sourceDirectory, final Path targetDirectory,
final CopyOption... copyOptions) throws IOException {
+ final Path absoluteSource = sourceDirectory.toAbsolutePath();
return visitFileTree(
- new CopyDirectoryVisitor(Counters.longPathCounters(), sourceDirectory, targetDirectory, copyOptions),
- sourceDirectory).getPathCounters();
+ new CopyDirectoryVisitor(Counters.longPathCounters(), absoluteSource, targetDirectory, copyOptions),
+ absoluteSource).getPathCounters();
}
/**
