From cc9028fbf9b082252615595dae5580c7cb38c952 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 27 Oct 2009 15:55:58 -0400 Subject: Fixed bug for running filename with no path; modules/textadept/run.lua --- modules/textadept/run.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'modules/textadept/run.lua') diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua index fcdb6a43..2b334fd1 100644 --- a/modules/textadept/run.lua +++ b/modules/textadept/run.lua @@ -17,7 +17,12 @@ module('_m.textadept.run', package.seeall) -- * %(filename_noext) The name of the file excluding extension. function execute(command) local filepath = textadept.iconv(buffer.filename, _CHARSET, 'UTF-8') - local filedir, filename = filepath:match('^(.+[/\\])([^/\\]+)$') + local filedir, filename + if filepath:find('[/\\]') then + filedir, filename = filepath:match('^(.+[/\\])([^/\\]+)$') + else + filedir, filename = '', filepath + end local filename_noext = filename:match('^(.+)%.') command = command:gsub('%%%b()', { ['%(filepath)'] = filepath, -- cgit v1.2.3