diff options
author | 2009-01-27 21:47:15 -0500 | |
---|---|---|
committer | 2009-01-27 21:47:15 -0500 | |
commit | 6369029ad7f4b9175574027abea15cfc4f6a49a0 (patch) | |
tree | ba08264a7c2e9d34a1c2f290da5b0dccffa3b3f9 /modules | |
parent | 94a974b31e106526ae9e626425580560221cb7a7 (diff) | |
download | textadept-6369029ad7f4b9175574027abea15cfc4f6a49a0.tar.gz textadept-6369029ad7f4b9175574027abea15cfc4f6a49a0.zip |
Do not open a non-existant file from _m.textadept.run.goto_error.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/textadept/run.lua | 15 |
1 files changed, 11 insertions, 4 deletions
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 |