diff options
author | Robbie Cooper <cooperra@users.noreply.github.com> | 2020-10-25 03:05:21 -0400 |
---|---|---|
committer | Robbie Cooper <cooperra@users.noreply.github.com> | 2020-10-25 03:05:21 -0400 |
commit | 85e99460b41d1b727b3ef4049ea3a5bac1e507d4 (patch) | |
tree | f4820d5574ed4d8ef3101d978dc7a5ca30fcdf91 | |
parent | 6c173e2f7ffdb972ec3754b3d78fe51bfbfb4f22 (diff) |
Fix file panel renaming unable to change the case of dirs on Windows
Tested on Windows 10.
-rw-r--r-- | drivers/windows/dir_access_windows.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/windows/dir_access_windows.cpp b/drivers/windows/dir_access_windows.cpp index 03e4e30797..9edea36d79 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)) { |