You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-05 17:15:09 +00:00
FileSystem dock: Improve duplicate check for directory paths
Supersedes and closes #30225.
This commit is contained in:
@@ -1324,14 +1324,14 @@ void FileSystemDock::_duplicate_operation_confirm() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String new_path;
|
|
||||||
String base_dir = to_duplicate.path.get_base_dir();
|
String base_dir = to_duplicate.path.get_base_dir();
|
||||||
if (to_duplicate.is_file) {
|
// get_base_dir() returns "some/path" if the original path was "some/path/", so work it around.
|
||||||
new_path = base_dir.plus_file(new_name);
|
if (to_duplicate.path.ends_with("/")) {
|
||||||
} else {
|
base_dir = base_dir.get_base_dir();
|
||||||
new_path = base_dir.substr(0, base_dir.find_last("/")).plus_file(new_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String new_path = base_dir.plus_file(new_name);
|
||||||
|
|
||||||
//Present a more user friendly warning for name conflict
|
//Present a more user friendly warning for name conflict
|
||||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||||
if (da->file_exists(new_path) || da->dir_exists(new_path)) {
|
if (da->file_exists(new_path) || da->dir_exists(new_path)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user