Merge pull request #96639 from bruvzg/symlink_ren
Fix renaming directory symlinks on Linux.
This commit is contained in:
commit
a87ceed163
1 changed files with 6 additions and 0 deletions
|
@ -397,12 +397,18 @@ Error DirAccessUnix::rename(String p_path, String p_new_path) {
|
||||||
}
|
}
|
||||||
|
|
||||||
p_path = fix_path(p_path);
|
p_path = fix_path(p_path);
|
||||||
|
if (p_path.ends_with("/")) {
|
||||||
|
p_path = p_path.left(-1);
|
||||||
|
}
|
||||||
|
|
||||||
if (p_new_path.is_relative_path()) {
|
if (p_new_path.is_relative_path()) {
|
||||||
p_new_path = get_current_dir().path_join(p_new_path);
|
p_new_path = get_current_dir().path_join(p_new_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
p_new_path = fix_path(p_new_path);
|
p_new_path = fix_path(p_new_path);
|
||||||
|
if (p_new_path.ends_with("/")) {
|
||||||
|
p_new_path = p_new_path.left(-1);
|
||||||
|
}
|
||||||
|
|
||||||
return ::rename(p_path.utf8().get_data(), p_new_path.utf8().get_data()) == 0 ? OK : FAILED;
|
return ::rename(p_path.utf8().get_data(), p_new_path.utf8().get_data()) == 0 ? OK : FAILED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue