1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Navigate to folder when double-clicking favorite

This commit is contained in:
kobewi
2025-02-08 20:47:47 +01:00
parent 36d90c73a8
commit 0cffaf788b

View File

@@ -1291,12 +1291,13 @@ void FileSystemDock::_tree_activate_file() {
String file_path = selected->get_metadata(0);
TreeItem *parent = selected->get_parent();
bool is_favorite = parent != nullptr && parent->get_metadata(0) == "Favorites";
bool is_folder = file_path.ends_with("/");
if ((!is_favorite && file_path.ends_with("/")) || file_path == "Favorites") {
if ((!is_favorite && is_folder) || file_path == "Favorites") {
bool collapsed = selected->is_collapsed();
selected->set_collapsed(!collapsed);
} else {
_select_file(file_path, is_favorite && !file_path.ends_with("/"), false);
_select_file(file_path, is_favorite && !is_folder, is_favorite && is_folder);
}
}
}