[studio] Fix file explorer to treat empty directories as directories
All checks were successful
Build / build (push) Successful in 3m32s

This commit is contained in:
Gary Talent 2025-01-27 23:31:58 -06:00
parent eaa9a2415e
commit 56b9cb6ebf

View File

@ -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>("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 {