From 761c915070e89bce0f804c963db6319763987a93 Mon Sep 17 00:00:00 2001 From: Robbie Cooper Date: Sun, 25 Oct 2020 03:05:21 -0400 Subject: [PATCH] Fix file panel renaming unable to change the case of dirs on Windows Tested on Windows 10. (cherry picked from commit 85e99460b41d1b727b3ef4049ea3a5bac1e507d4) --- drivers/windows/dir_access_windows.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index 2b65e99bd01..9d68bf8bd4a 100644 --- a/drivers/windows/dir_access_windows.cpp +++ b/drivers/windows/dir_access_windows.cpp @@ -257,6 +257,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(p_path.c_str(), p_new_path.c_str()) == 0 ? OK : FAILED; + } + // The path is a file; juggle WCHAR tmpfile[MAX_PATH]; if (!GetTempFileNameW(fix_path(get_current_dir()).c_str(), NULL, 0, tmpfile)) {