From 14ee3e0bf143916f29b2fb05465b9e79707f4611 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Thu, 15 Jan 2015 16:12:16 -0500 Subject: Fix opening network path files on Win32. Thanks to Daniel Wutke. --- core/lfs_ext.lua | 3 ++- core/ui.lua | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/lfs_ext.lua b/core/lfs_ext.lua index 52333796..8b96b861 100644 --- a/core/lfs_ext.lua +++ b/core/lfs_ext.lua @@ -113,7 +113,8 @@ end -- @name abspath function lfs.abspath(filename, prefix) if WIN32 then filename = filename:gsub('/', '\\') end - if not filename:find(not WIN32 and '^/' or '^%a:[/\\]') then + if not filename:find(not WIN32 and '^/' or '^%a:[/\\]') and + not (WIN32 and filename:find('^\\\\')) then prefix = prefix or lfs.currentdir() filename = prefix..(not WIN32 and '/' or '\\')..filename end diff --git a/core/ui.lua b/core/ui.lua index da6e04a1..46e1c311 100644 --- a/core/ui.lua +++ b/core/ui.lua @@ -303,7 +303,8 @@ events_connect(events.URI_DROPPED, function(utf8_uris) uri = uri:match('^file://([^\r\n]+)'):gsub('%%(%x%x)', function(hex) return string.char(tonumber(hex, 16)) end) - if WIN32 then uri = uri:sub(2, -1) end -- ignore leading '/' + -- In WIN32, ignore a leading '/', but not '//' (network path). + if WIN32 and not uri:match('^//') then uri = uri:sub(2, -1) end local mode = lfs.attributes(uri, 'mode') if mode and mode ~= 'directory' then io.open_file(uri) end end -- cgit v1.2.3