summaryrefslogtreecommitdiff
path: root/drivers/windows
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-02 21:04:13 +0200
committerGitHub <noreply@github.com>2021-10-02 21:04:13 +0200
commitd97f223350ab6c712cf376efae255044c887a71e (patch)
treee5372f56f164e54e811677461bad889c223f9396 /drivers/windows
parent3c30ca4637be2d76bc05f040a58a7f18262c77b8 (diff)
parent85e99460b41d1b727b3ef4049ea3a5bac1e507d4 (diff)
Merge pull request #43068 from cooperra/rename-fix
Diffstat (limited to 'drivers/windows')
-rw-r--r--drivers/windows/dir_access_windows.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp
index f7a5f7279e..ae781e9424 100644
--- a/drivers/windows/dir_access_windows.cpp
+++ b/drivers/windows/dir_access_windows.cpp
@@ -256,6 +256,11 @@ Error DirAccessWindows::rename(String p_path, String p_new_path) {
// If we're only changing file name case we need to do a little juggling
if (p_path.to_lower() == p_new_path.to_lower()) {
+ if (dir_exists(p_path)) {
+ // The path is a dir; just rename
+ return ::_wrename((LPCWSTR)(p_path.utf16().get_data()), (LPCWSTR)(p_new_path.utf16().get_data())) == 0 ? OK : FAILED;
+ }
+ // The path is a file; juggle
WCHAR tmpfile[MAX_PATH];
if (!GetTempFileNameW((LPCWSTR)(fix_path(get_current_dir()).utf16().get_data()), nullptr, 0, tmpfile)) {