Skip to content

Commit

Permalink
Merge pull request #143 from actboy168/patch-1
Browse files Browse the repository at this point in the history
Fixes skip_existing on fs::copy
  • Loading branch information
gulrak committed Mar 3, 2023
2 parents 4041174 + f6d7d5b commit de64dec
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions include/ghc/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3920,11 +3920,14 @@ GHC_INLINE bool copy_file(const path& from, const path& to, copy_options options
ec = tecf;
return false;
}
if (exists(st) && (!is_regular_file(st) || equivalent(from, to, ec) || (options & (copy_options::skip_existing | copy_options::overwrite_existing | copy_options::update_existing)) == copy_options::none)) {
ec = tect ? tect : detail::make_error_code(detail::portable_error::exists);
return false;
}
if (exists(st)) {
if ((options & copy_options::skip_existing) == copy_options::skip_existing) {
return false;
}
if (!is_regular_file(st) || equivalent(from, to, ec) || (options & (copy_options::overwrite_existing | copy_options::update_existing)) == copy_options::none) {
ec = tect ? tect : detail::make_error_code(detail::portable_error::exists);
return false;
}
if ((options & copy_options::update_existing) == copy_options::update_existing) {
auto from_time = last_write_time(from, ec);
if (ec) {
Expand Down

0 comments on commit de64dec

Please sign in to comment.