Merge pull request #34695 from timothyqiu/show-in-file-system

Checks script path before show in filesystem
This commit is contained in:
Rémi Verschelde 2019-12-30 18:15:29 +01:00 committed by GitHub
commit 870b5ba2dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1270,12 +1270,15 @@ void ScriptEditor::_menu_option(int p_option) {
_copy_script_path(); _copy_script_path();
} break; } break;
case SHOW_IN_FILE_SYSTEM: { case SHOW_IN_FILE_SYSTEM: {
RES script = current->get_edited_resource(); const RES script = current->get_edited_resource();
FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock(); const String path = script->get_path();
file_system_dock->navigate_to_path(script->get_path()); if (!path.empty()) {
// Ensure that the FileSystem dock is visible. FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock();
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control(); file_system_dock->navigate_to_path(path);
tab_container->set_current_tab(file_system_dock->get_position_in_parent()); // Ensure that the FileSystem dock is visible.
TabContainer *tab_container = (TabContainer *)file_system_dock->get_parent_control();
tab_container->set_current_tab(file_system_dock->get_position_in_parent());
}
} break; } break;
case CLOSE_DOCS: { case CLOSE_DOCS: {
_close_docs_tab(); _close_docs_tab();