From 28b1844a8bb025f066baf67da000309ac7df0c13 Mon Sep 17 00:00:00 2001 From: rxi Date: Sat, 23 May 2020 11:31:08 +0100 Subject: [PATCH] Added support for dropping a folder onto the window --- data/core/init.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/data/core/init.lua b/data/core/init.lua index 12435a6..e63e2a4 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -318,11 +318,16 @@ function core.on_event(type, ...) core.root_view:on_mouse_wheel(...) elseif type == "filedropped" then local filename, mx, my = ... - local ok, doc = core.try(core.open_doc, filename) - if ok then - local node = core.root_view.root_node:get_child_overlapping_point(mx, my) - node:set_active_view(node.active_view) - core.root_view:open_doc(doc) + local info = system.get_file_info(filename) + if info and info.type == "dir" then + system.exec(string.format("%q %q", EXEFILE, filename)) + else + local ok, doc = core.try(core.open_doc, filename) + if ok then + local node = core.root_view.root_node:get_child_overlapping_point(mx, my) + node:set_active_view(node.active_view) + core.root_view:open_doc(doc) + end end elseif type == "quit" then core.quit()