1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-15 13:51:40 +00:00

Don't navigate to path when file is double-clicked

This commit is contained in:
kobewi
2024-12-04 15:19:01 +01:00
parent 47bc374edf
commit 6e490dadcd
2 changed files with 6 additions and 4 deletions

View File

@@ -1191,7 +1191,7 @@ HashSet<String> FileSystemDock::_get_valid_conversions_for_file_paths(const Vect
return all_valid_conversion_to_targets; return all_valid_conversion_to_targets;
} }
void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorites) { void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorites, bool p_navigate) {
String fpath = p_path; String fpath = p_path;
if (fpath.ends_with("/")) { if (fpath.ends_with("/")) {
// Ignore a directory. // Ignore a directory.
@@ -1258,7 +1258,9 @@ void FileSystemDock::_select_file(const String &p_path, bool p_select_in_favorit
EditorNode::get_singleton()->load_resource(fpath); EditorNode::get_singleton()->load_resource(fpath);
} }
} }
_navigate_to_path(fpath, p_select_in_favorites); if (p_navigate) {
_navigate_to_path(fpath, p_select_in_favorites);
}
} }
void FileSystemDock::_tree_activate_file() { void FileSystemDock::_tree_activate_file() {
@@ -1272,7 +1274,7 @@ void FileSystemDock::_tree_activate_file() {
bool collapsed = selected->is_collapsed(); bool collapsed = selected->is_collapsed();
selected->set_collapsed(!collapsed); selected->set_collapsed(!collapsed);
} else { } else {
_select_file(file_path, is_favorite && !file_path.ends_with("/")); _select_file(file_path, is_favorite && !file_path.ends_with("/"), false);
} }
} }
} }

View File

@@ -262,7 +262,7 @@ private:
void _set_file_display(bool p_active); void _set_file_display(bool p_active);
void _fs_changed(); void _fs_changed();
void _select_file(const String &p_path, bool p_select_in_favorites = false); void _select_file(const String &p_path, bool p_select_in_favorites = false, bool p_navigate = true);
void _tree_activate_file(); void _tree_activate_file();
void _file_list_activate_file(int p_idx); void _file_list_activate_file(int p_idx);
void _file_multi_selected(int p_index, bool p_selected); void _file_multi_selected(int p_index, bool p_selected);