Skip to content

Commit

Permalink
Add fix for issue #3971
Browse files Browse the repository at this point in the history
File modified:

    src/core.c/IO/Path.pm6
  • Loading branch information
tbrowder committed Oct 19, 2020
1 parent d713e45 commit 41a76ca
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/core.c/IO/Path.pm6
Expand Up @@ -448,6 +448,13 @@ my class IO::Path is Cool does IO {
}

method copy(IO::Path:D: IO() $to, :$createonly --> True) {
# add fix for issue #3971 where attempt to copy a dir
# to a file clobbers the file.
self.d and $to.f and fail X::IO::Copy.new:
:from($.absolute),
:to($to.absolute),
:os-error('cannot copy a directory to a file');

$createonly and $to.e and fail X::IO::Copy.new:
:from($.absolute),
:to($to.absolute),
Expand Down

0 comments on commit 41a76ca

Please sign in to comment.