Added support for dropping a folder onto the window

This commit is contained in:
rxi 2020-05-23 11:31:08 +01:00
parent e45b3e2bc0
commit 28b1844a8b

View file

@ -318,12 +318,17 @@ function core.on_event(type, ...)
core.root_view:on_mouse_wheel(...)
elseif type == "filedropped" then
local filename, mx, my = ...
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()
end