| 1115 | } |
| 1116 | |
| 1117 | bool RenameOver(fs::path src, fs::path dest) |
| 1118 | { |
| 1119 | #ifdef __MINGW64__ |
| 1120 | // This is a workaround for a bug in libstdc++ which |
| 1121 | // implements std::filesystem::rename with _wrename function. |
| 1122 | // This bug has been fixed in upstream: |
| 1123 | // - GCC 10.3: 8dd1c1085587c9f8a21bb5e588dfe1e8cdbba79e |
| 1124 | // - GCC 11.1: 1dfd95f0a0ca1d9e6cbc00e6cbfd1fa20a98f312 |
| 1125 | // For more details see the commits mentioned above. |
| 1126 | return MoveFileExW(src.wstring().c_str(), dest.wstring().c_str(), |
| 1127 | MOVEFILE_REPLACE_EXISTING) != 0; |
| 1128 | #else |
| 1129 | std::error_code error; |
| 1130 | fs::rename(src, dest, error); |
| 1131 | return !error; |
| 1132 | #endif |
| 1133 | } |
| 1134 | |
| 1135 | /** |
| 1136 | * Ignores exceptions thrown by create_directories if the requested directory exists. |
no outgoing calls