Skip to content

Commit 413631d

Browse files
committed
fix os.copy with mergeFolders set to true
1 parent 36e00e0 commit 413631d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

os/src/FileOps.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ object copy {
202202

203203
def copyOne(p: Path): Unit = {
204204
val target = to / p.relativeTo(from)
205-
if (mergeFolders && isDir(p, followLinks) && isDir(target, followLinks)) {
205+
if (mergeFolders && isDir(p, false) && !exists(target, false)) {
206+
os.makeDir(target)
207+
} else if (mergeFolders && isDir(p, followLinks) && isDir(target, followLinks)) {
206208
// nothing to do
207209
} else {
208210
Files.copy(p.wrapped, target.wrapped, opts1 ++ opts2 ++ opts3: _*)

0 commit comments

Comments
 (0)