diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-02-09 17:38:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-09 17:38:23 +0100 |
commit | fa4ddbcb33fc5244e80099bd558e623428e424f5 (patch) | |
tree | 58546cb59f3702e8188d88f93db9da4a24fbe8c6 | |
parent | df9c98e107b19fc50bc5ae9f7ed624d693c0fb32 (diff) | |
parent | cf9d5cec220406bebba4128e27853e4351d6af8f (diff) |
Merge pull request #45848 from YeldhamDev/filesys_basedir_path
Make FileSystem dock set its path to the base folder of files after changes
-rw-r--r-- | editor/filesystem_dock.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index e1c66f43b9..ab5fd30998 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1411,14 +1411,26 @@ void FileSystemDock::_make_scene_confirm() { void FileSystemDock::_file_removed(String p_file) { emit_signal("file_removed", p_file); - path = "res://"; + // Find the closest parent directory available, in case multiple items were deleted along the same path. + path = p_file.get_base_dir(); + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + while (!da->dir_exists(path)) { + path = path.get_base_dir(); + } + current_path->set_text(path); } void FileSystemDock::_folder_removed(String p_folder) { emit_signal("folder_removed", p_folder); - path = "res://"; + // Find the closest parent directory available, in case multiple items were deleted along the same path. + path = p_folder.get_base_dir(); + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES); + while (!da->dir_exists(path)) { + path = path.get_base_dir(); + } + current_path->set_text(path); } @@ -1586,7 +1598,7 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_ove print_verbose("FileSystem: saving moved scenes."); _save_scenes_after_move(file_renames); - path = "res://"; + path = p_to_path; current_path->set_text(path); } } |