From 04991969edff0bb43395fd59c1871491990bdee4 Mon Sep 17 00:00:00 2001 From: vPumpking Date: Sat, 5 Oct 2024 19:25:11 +0200 Subject: [PATCH] Add a menu option to open the project directory Add a menu item in Project menu that opens the project directory with the default file manager. --- editor/editor_node.cpp | 4 ++++ editor/editor_node.h | 1 + 2 files changed, 5 insertions(+) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d88fb134f16..e28f86fe764 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2973,6 +2973,9 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } } } break; + case RUN_PROJECT_FOLDER: { + OS::get_singleton()->shell_show_in_file_manager(OS::get_singleton()->get_resource_dir(), true); + } break; case RUN_USER_DATA_FOLDER: { // Ensure_user_data_dir() to prevent the edge case: "Open User Data Folder" won't work after the project was renamed in ProjectSettingsEditor unless the project is saved. OS::get_singleton()->ensure_user_data_dir(); @@ -7281,6 +7284,7 @@ EditorNode::EditorNode() { project_menu->add_shortcut(ED_SHORTCUT_AND_COMMAND("editor/export", TTR("Export..."), Key::NONE, TTR("Export")), FILE_EXPORT_PROJECT); #ifndef ANDROID_ENABLED project_menu->add_item(TTR("Install Android Build Template..."), FILE_INSTALL_ANDROID_SOURCE); + project_menu->add_item(TTR("Open Project Folder"), RUN_PROJECT_FOLDER); project_menu->add_item(TTR("Open User Data Folder"), RUN_USER_DATA_FOLDER); #endif diff --git a/editor/editor_node.h b/editor/editor_node.h index 696caf857c8..9483a1a02e9 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -186,6 +186,7 @@ private: RESOURCE_SAVE_AS, RUN_SETTINGS, + RUN_PROJECT_FOLDER, RUN_USER_DATA_FOLDER, RELOAD_CURRENT_PROJECT, RUN_PROJECT_MANAGER,