[studio] Fix file explorer to treat empty directories as directories
All checks were successful
Build / build (push) Successful in 3m32s
All checks were successful
Build / build (push) Successful in 3m32s
This commit is contained in:
parent
eaa9a2415e
commit
56b9cb6ebf
@ -88,7 +88,7 @@ FileTreeModel::FileTreeModel(
|
|||||||
void FileTreeModel::draw(turbine::Context &tctx) const noexcept {
|
void FileTreeModel::draw(turbine::Context &tctx) const noexcept {
|
||||||
constexpr auto dirFlags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick;
|
constexpr auto dirFlags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick;
|
||||||
auto const selected = m_explorer.selected(this) ? ImGuiTreeNodeFlags_Selected : 0;
|
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);
|
auto const nodeOpen = ImGui::TreeNodeEx(m_name.c_str(), dirFlags | selected);
|
||||||
if (ImGui::IsItemActivated() || ImGui::IsItemClicked(1)) {
|
if (ImGui::IsItemActivated() || ImGui::IsItemClicked(1)) {
|
||||||
m_explorer.setSelectedNode(this);
|
m_explorer.setSelectedNode(this);
|
||||||
@ -104,7 +104,8 @@ void FileTreeModel::draw(turbine::Context &tctx) const noexcept {
|
|||||||
if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
|
if (ig::DragDropTarget const dragDropTarget; dragDropTarget) {
|
||||||
auto const [ref, err] = ig::getDragDropPayload<FileRef>("FileRef");
|
auto const [ref, err] = ig::getDragDropPayload<FileRef>("FileRef");
|
||||||
if (!err) {
|
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) {
|
if (ref.isDir) {
|
||||||
m_explorer.dirMoved(ref.path, sfmt("{}/{}", m_fullPath, name));
|
m_explorer.dirMoved(ref.path, sfmt("{}/{}", m_fullPath, name));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user