From 5dce9dd3773e5cde7cc98ea6ba26426f01e79b7d Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Tue, 28 Jan 2025 01:27:51 -0600 Subject: [PATCH] [studio] Suppress context menu for root dir in ProjectExplorer --- .../studio/applib/src/projectexplorer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/olympic/studio/applib/src/projectexplorer.cpp b/src/olympic/studio/applib/src/projectexplorer.cpp index f0edd82a..8a092f80 100644 --- a/src/olympic/studio/applib/src/projectexplorer.cpp +++ b/src/olympic/studio/applib/src/projectexplorer.cpp @@ -47,17 +47,17 @@ void ProjectExplorer::fileContextMenu(ox::StringViewCR path) const noexcept { } void ProjectExplorer::dirContextMenu(ox::StringViewCR path) const noexcept { - if (ImGui::BeginPopupContextItem("DirMenu", ImGuiPopupFlags_MouseButtonRight)) { - if (ImGui::MenuItem("Add Item")) { - addItem.emit(path); - } - if (ImGui::MenuItem("Add Directory")) { - addDir.emit(path); - } + if (path.len() && ImGui::BeginPopupContextItem("DirMenu", ImGuiPopupFlags_MouseButtonRight)) { + if (ImGui::MenuItem("Add Item")) { + addItem.emit(path); + } + if (ImGui::MenuItem("Add Directory")) { + addDir.emit(path); + } if (ImGui::MenuItem("Delete")) { deleteItem.emit(path); } - ImGui::EndPopup(); + ImGui::EndPopup(); } }