Unfortunately, bitcoin/bitcoin#24308 introduced a regression for mingw builds.
The root of the problem is a broken implementation of std::filesystem::rename
. In particular, the expected behavior
If
old_p
is a non-directory file, thennew_p
must be … existing non-directory file:new_p
is first deleted…
fails with the “File exists” error.
This PR reverts back the MoveFileExW
call, and adds the suggested unit test.