From 56b9cb6ebf8ba831ff8dcd67eb9238c9ec4c6b77 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Mon, 27 Jan 2025 23:31:58 -0600 Subject: [PATCH] [studio] Fix file explorer to treat empty directories as directories --- src/olympic/studio/modlib/src/filetreemodel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/olympic/studio/modlib/src/filetreemodel.cpp b/src/olympic/studio/modlib/src/filetreemodel.cpp index d7d347a0..9a364b25 100644 --- a/src/olympic/studio/modlib/src/filetreemodel.cpp +++ b/src/olympic/studio/modlib/src/filetreemodel.cpp @@ -88,7 +88,7 @@ FileTreeModel::FileTreeModel( void FileTreeModel::draw(turbine::Context &tctx) const noexcept { constexpr auto dirFlags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick; auto const selected = m_explorer.selected(this) ? ImGuiTreeNodeFlags_Selected : 0; - if (!m_children.empty()) { + if (m_fileType == ox::FileType::Directory) { auto const nodeOpen = ImGui::TreeNodeEx(m_name.c_str(), dirFlags | selected); if (ImGui::IsItemActivated() || ImGui::IsItemClicked(1)) { m_explorer.setSelectedNode(this); @@ -104,7 +104,8 @@ void FileTreeModel::draw(turbine::Context &tctx) const noexcept { if (ig::DragDropTarget const dragDropTarget; dragDropTarget) { auto const [ref, err] = ig::getDragDropPayload("FileRef"); if (!err) { - auto const name = substr(ref.path, find(ref.path.rbegin(), ref.path.rend(), '/').offset() + 1); + auto const name = substr( + ref.path, find(ref.path.rbegin(), ref.path.rend(), '/').offset() + 1); if (ref.isDir) { m_explorer.dirMoved(ref.path, sfmt("{}/{}", m_fullPath, name)); } else {