Re: [textadept] uri_dropped on Windows

From: mitchell <c....at.caladbolg.net>
Date: Wed, 21 Jul 2010 18:43:19 -0400 (EDT)

Rob,

> 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)

Thanks. Comitted.

mitchell
Received on Wed 21 Jul 2010 - 18:43:19 EDT

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