diff options
-rw-r--r-- | core/locale.lua | 4 | ||||
-rw-r--r-- | modules/textadept/run.lua | 15 |
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 |