Minor and tweaked refactoring from
by Andrew Shcheglov
(ashcheglov on GitHub).
MODIFY
src/main/java/org/apache/commons/io/file/PathUtils.java
src/main/java/org/apache/commons/io/file/PathUtils.java
@@ -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();
}
/**

Minor and tweaked refactoring from
https://github.com/apache/commons-io/pull/203 by Andrew Shcheglov
(ashcheglov on GitHub).