aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2009-01-27 21:47:15 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2009-01-27 21:47:15 -0500
commit6369029ad7f4b9175574027abea15cfc4f6a49a0 (patch)
treeba08264a7c2e9d34a1c2f290da5b0dccffa3b3f9
parent94a974b31e106526ae9e626425580560221cb7a7 (diff)
downloadtextadept-6369029ad7f4b9175574027abea15cfc4f6a49a0.tar.gz
textadept-6369029ad7f4b9175574027abea15cfc4f6a49a0.zip
Do not open a non-existant file from _m.textadept.run.goto_error.
-rw-r--r--core/locale.lua4
-rw-r--r--modules/textadept/run.lua15
2 files changed, 15 insertions, 4 deletions
diff --git a/core/locale.lua b/core/locale.lua
index 573b25be..52db58b9 100644
--- a/core/locale.lua
+++ b/core/locale.lua
@@ -569,6 +569,10 @@ M_TEXTADEPT_MACRO_SELECT_TEXT = 'Macro name:'
-- modules/textadept/mlines.lua
+-- modules/textadept/run.lua
+-- The file "%s" does not exist.
+M_TEXTADEPT_RUN_FILE_DOES_NOT_EXIST = 'The file "%s" does not exist.'
+
-- modules/textadept/snippets.lua
-- Lexer %s
diff --git a/modules/textadept/run.lua b/modules/textadept/run.lua
index 9a9901f9..f60bf2b5 100644
--- a/modules/textadept/run.lua
+++ b/modules/textadept/run.lua
@@ -184,10 +184,17 @@ function goto_error(pos, line_num)
for _, error_detail in pairs(error_details) do
local captures = { line:match(error_detail.pattern) }
if #captures > 0 then
- textadept.io.open(captures[error_detail.filename])
- _m.textadept.editing.goto_line(captures[error_detail.line])
- local msg = captures[error_detail.message]
- if msg then buffer:call_tip_show(buffer.current_pos, msg) end
+ local lfs = require 'lfs'
+ local filename = captures[error_detail.filename]
+ if lfs.attributes(filename) then
+ textadept.io.open(filename)
+ _m.textadept.editing.goto_line(captures[error_detail.line])
+ local msg = captures[error_detail.message]
+ if msg then buffer:call_tip_show(buffer.current_pos, msg) end
+ else
+ error(string.format(
+ textadept.locale.M_TEXTADEPT_RUN_FILE_DOES_NOT_EXIST, filename))
+ end
break
end
end