Skip to content

Commit a87ceed

Browse files
committed
Merge pull request #96639 from bruvzg/symlink_ren
Fix renaming directory symlinks on Linux.
2 parents 1723fd9 + 3e936e7 commit a87ceed

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

drivers/unix/dir_access_unix.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,18 @@ Error DirAccessUnix::rename(String p_path, String p_new_path) {
397397
}
398398

399399
p_path = fix_path(p_path);
400+
if (p_path.ends_with("/")) {
401+
p_path = p_path.left(-1);
402+
}
400403

401404
if (p_new_path.is_relative_path()) {
402405
p_new_path = get_current_dir().path_join(p_new_path);
403406
}
404407

405408
p_new_path = fix_path(p_new_path);
409+
if (p_new_path.ends_with("/")) {
410+
p_new_path = p_new_path.left(-1);
411+
}
406412

407413
return ::rename(p_path.utf8().get_data(), p_new_path.utf8().get_data()) == 0 ? OK : FAILED;
408414
}

0 commit comments

Comments
 (0)