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.
This commit is contained in:
vPumpking 2024-10-05 19:25:11 +02:00
parent db66bd35af
commit 04991969ed
2 changed files with 5 additions and 0 deletions

View file

@ -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

View file

@ -186,6 +186,7 @@ private:
RESOURCE_SAVE_AS,
RUN_SETTINGS,
RUN_PROJECT_FOLDER,
RUN_USER_DATA_FOLDER,
RELOAD_CURRENT_PROJECT,
RUN_PROJECT_MANAGER,