mirror of https://github.com/godotengine/godot
Navigate to folder when double-clicking favorite
This commit is contained in:
parent
36d90c73a8
commit
0cffaf788b
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue