Added support for dropping a folder onto the window
This commit is contained in:
parent
e45b3e2bc0
commit
28b1844a8b
|
@ -318,11 +318,16 @@ function core.on_event(type, ...)
|
||||||
core.root_view:on_mouse_wheel(...)
|
core.root_view:on_mouse_wheel(...)
|
||||||
elseif type == "filedropped" then
|
elseif type == "filedropped" then
|
||||||
local filename, mx, my = ...
|
local filename, mx, my = ...
|
||||||
local ok, doc = core.try(core.open_doc, filename)
|
local info = system.get_file_info(filename)
|
||||||
if ok then
|
if info and info.type == "dir" then
|
||||||
local node = core.root_view.root_node:get_child_overlapping_point(mx, my)
|
system.exec(string.format("%q %q", EXEFILE, filename))
|
||||||
node:set_active_view(node.active_view)
|
else
|
||||||
core.root_view:open_doc(doc)
|
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
|
end
|
||||||
elseif type == "quit" then
|
elseif type == "quit" then
|
||||||
core.quit()
|
core.quit()
|
||||||
|
|
Loading…
Reference in a new issue