Checks script path before show in filesystem

This commit is contained in:
Haoyu Qiu 2019-12-30 09:49:52 +08:00
parent b8e8f4942d
commit 9ae39be64f

View file

@ -1267,12 +1267,15 @@ void ScriptEditor::_menu_option(int p_option) {
_copy_script_path();
} break;
case SHOW_IN_FILE_SYSTEM: {
RES script = current->get_edited_resource();
FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock();
file_system_dock->navigate_to_path(script->get_path());
// 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());
const RES script = current->get_edited_resource();
const String path = script->get_path();
if (!path.empty()) {
FileSystemDock *file_system_dock = EditorNode::get_singleton()->get_filesystem_dock();
file_system_dock->navigate_to_path(path);
// 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;
case CLOSE_DOCS: {
_close_docs_tab();