Skip to content

Commit

Permalink
Fix Windows specific rename behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
bugdea1er committed Oct 8, 2024
1 parent 8aff34b commit 02096e2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,17 @@ void entry::move(const fs::path& to) {
throw_move_error(to, ec);
}

if (fs::is_directory(*this) && !fs::is_directory(to)) {
ec = std::make_error_code(std::errc::not_a_directory);
throw_move_error(to, ec);
if (fs::is_directory(*this)) {
if (!fs::is_directory(to)) {
ec = std::make_error_code(std::errc::not_a_directory);
throw_move_error(to, ec);
}

#ifdef WIN32
if (!fs::equivalent(path(), to)) {
fs::remove_all(to);
}
#endif
}
}

Expand Down

0 comments on commit 02096e2

Please sign in to comment.