Skip to content

Commit

Permalink
Merge pull request #43068 from cooperra/rename-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga authored Oct 2, 2021
2 parents 3c30ca4 + 85e9946 commit d97f223
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/windows/dir_access_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit d97f223

Please sign in to comment.