aboutsummaryrefslogtreecommitdiff
path: root/modules/textadept/run.lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/textadept/run.lua')
-rw-r--r--modules/textadept/run.lua7
1 files changed, 6 insertions, 1 deletions
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,