aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-02-13 17:30:21 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2022-02-14 16:56:35 +0200
commitd4999d40b9bd04dc20111aaaa6ed2d3db1a5caf9 (patch)
treebb1b5ae787eed795a6cdd7433da9324d07a91827 /src
parent25a91a571a4f3453f7e0e9299ee7a40a61d04f19 (diff)
util: Revert back MoveFileExW call for MinGW-w64
Diffstat (limited to 'src')
-rw-r--r--src/util/system.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 5cef2be07a..69811a751b 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -1062,9 +1062,20 @@ void ArgsManager::LogArgs() const
bool RenameOver(fs::path src, fs::path dest)
{
+#ifdef __MINGW64__
+ // This is a workaround for a bug in libstdc++ which
+ // implements std::filesystem::rename with _wrename function.
+ // This bug has been fixed in upstream:
+ // - GCC 10.3: 8dd1c1085587c9f8a21bb5e588dfe1e8cdbba79e
+ // - GCC 11.1: 1dfd95f0a0ca1d9e6cbc00e6cbfd1fa20a98f312
+ // For more details see the commits mentioned above.
+ return MoveFileExW(src.wstring().c_str(), dest.wstring().c_str(),
+ MOVEFILE_REPLACE_EXISTING) != 0;
+#else
std::error_code error;
fs::rename(src, dest, error);
return !error;
+#endif
}
/**