From db102bc9448f0606fd3750c8961863af9483ebfc Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 25 Jan 2009 10:56:55 -0500 Subject: Fixed bug with URI dropping and do nothing with directory drops; core/events.lua --- core/events.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/events.lua') diff --git a/core/events.lua b/core/events.lua index ce91452c..d7897c6d 100644 --- a/core/events.lua +++ b/core/events.lua @@ -408,14 +408,15 @@ add_handler('save_point_left', add_handler('uri_dropped', function(uris) + local lfs = require 'lfs' for uri in uris:gmatch('[^\r\n\f]+') do if uri:match('^file://') then uri = uri:match('^file://([^\r\n\f]+)') - if WIN32 then - uri = uri:sub(2, -1) -- ignore leading '/' - uri = uri:gsub('%%20', ' ') -- sub back for spaces + uri = uri:gsub('%%20', ' ') -- sub back for spaces + if WIN32 then uri = uri:sub(2, -1) end -- ignore leading '/' + if lfs.attributes(uri).mode ~= 'directory' then + textadept.io.open(uri) end - textadept.io.open(uri) end end end) -- cgit v1.2.3