uri_dropped on Windows

From: Robert <ro....at.web.de>
Date: Mon, 12 Jul 2010 09:08:12 +0200

Hi,
if I drop a file on Textadept on Windows 2000 to open it its filename
contains forward slashes. When I open the file with the file dialog it
is opened again with forward slashes.

I changed the uri_dropped event to replace the forward slashes with
backward slashes which seems to fix it.

events.lua, l.312

connect('uri_dropped',
  function(utf8_uris)
    local lfs = require 'lfs'
    for utf8_uri in utf8_uris:gmatch('[^\r\n\f]+') do
      if utf8_uri:find('^file://') then
        utf8_uri = utf8_uri:match('^file://([^\r\n\f]+)')
        utf8_uri = utf8_uri:gsub('%%(%x%x)',
          function(hex) return string.char(tonumber(hex, 16)) end)
        if WIN32 then
          utf8_uri = utf8_uri:sub(2, -1) -- ignore leading '/'
          utf8_uri = utf8_uri:gsub('/', '\\')
        end
        local uri = utf8_uri:iconv(_CHARSET, 'UTF-8')
        if lfs.attributes(uri).mode ~= 'directory' then
          io.open_file(utf8_uri)
        end
      end
    end
  end)

Robert
Received on Mon 12 Jul 2010 - 03:08:12 EDT

This archive was generated by hypermail 2.2.0 : Thu 08 Mar 2012 - 11:50:23 EST