File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -1200,10 +1200,15 @@ namespace RTE {
1200
1200
fullOldPath = GetCaseInsensitiveFullPath (fullOldPath);
1201
1201
fullNewPath = GetCaseInsensitiveFullPath (fullNewPath);
1202
1202
#endif
1203
- try {
1204
- std::filesystem::rename (fullOldPath, fullNewPath);
1205
- return true ;
1206
- } catch (const std::filesystem::filesystem_error &e) {}
1203
+ // Ensures parity between Linux which can overwrite an empty directory, while Windows can't
1204
+ // Ensures parity between Linux which can't rename a directory to a newPath that is a file in order to overwrite it, while Windows can
1205
+ if (!std::filesystem::exists (fullNewPath))
1206
+ {
1207
+ try {
1208
+ std::filesystem::rename (fullOldPath, fullNewPath);
1209
+ return true ;
1210
+ } catch (const std::filesystem::filesystem_error &e) {}
1211
+ }
1207
1212
}
1208
1213
g_ConsoleMan.PrintString (" ERROR: Failed to rename oldPath " + oldPath + " to newPath " + newPath);
1209
1214
return false ;
You can’t perform that action at this time.
0 commit comments