diff --git a/include/ghc/filesystem.hpp b/include/ghc/filesystem.hpp index e25f1d1..df3c1e7 100644 --- a/include/ghc/filesystem.hpp +++ b/include/ghc/filesystem.hpp @@ -3169,7 +3169,7 @@ GHC_INLINE void copy(const path& from, const path& to, copy_options options, std copy_file(from, to / from.filename(), options, ec); } else { - copy_file(from, to, ec); + copy_file(from, to, options, ec); } } } diff --git a/test/filesystem_test.cpp b/test/filesystem_test.cpp index 716e54e..f36f0d3 100644 --- a/test/filesystem_test.cpp +++ b/test/filesystem_test.cpp @@ -1553,6 +1553,10 @@ TEST_CASE("30.10.15.3 copy", "[filesystem][operations][fs.op.copy]") CHECK(fs::exists("dir4/file1")); CHECK(fs::exists("dir4/file2")); CHECK(fs::exists("dir4/dir2/file3")); + fs::create_directory("dir5"); + generateFile("dir5/file1"); + CHECK_THROWS_AS(fs::copy("dir1/file1", "dir5/file1"), fs::filesystem_error); + CHECK_NOTHROW(fs::copy("dir1/file1", "dir5/file1", fs::copy_options::skip_existing)); } if (is_symlink_creation_supported()) { TemporaryDirectory t(TempOpt::change_path);