diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/file_io.lua | 8 | ||||
-rwxr-xr-x | core/locale.conf | 1 |
2 files changed, 6 insertions, 3 deletions
diff --git a/core/file_io.lua b/core/file_io.lua index 6a1735e8..b6643f64 100644 --- a/core/file_io.lua +++ b/core/file_io.lua @@ -125,11 +125,13 @@ local function open_helper(utf8_filename) local text local filename = utf8_filename:iconv(_CHARSET, 'UTF-8') - local f = io.open(filename, 'rb') + local f, err = io.open(filename, 'rb') if f then text = f:read('*all') f:close() if not text then return end -- filename exists, but can't read it + else + error(err) end local buffer = new_buffer() if text then @@ -206,7 +208,7 @@ local function reload(buffer) local first_visible_line = buffer.first_visible_line local filename = buffer.filename:iconv(_CHARSET, 'UTF-8') local f, err = io.open(filename, 'rb') - if not f then return end + if not f then error(err) end local text = f:read('*all') f:close() local encoding, encoding_bom = buffer.encoding, buffer.encoding_bom @@ -223,7 +225,7 @@ end -- LuaDoc is in core/.buffer.lua. local function set_encoding(buffer, encoding) gui.check_focused_buffer(buffer) - if not buffer.encoding then error('Cannot change binary file encoding') end + if not buffer.encoding then error(L('Cannot change binary file encoding')) end local pos = buffer.current_pos local first_visible_line = buffer.first_visible_line local text = buffer:get_text(buffer.length) diff --git a/core/locale.conf b/core/locale.conf index 1c58b164..2f87cfbc 100755 --- a/core/locale.conf +++ b/core/locale.conf @@ -33,6 +33,7 @@ Quit _without saving = Quit _without saving % core/file_io.lua Encoding conversion failed. = Encoding conversion failed. Open = Open +Cannot change binary file encoding = Cannot change binary file encoding Save = Save Close without saving? = Close without saving? There are unsaved changes in = There are unsaved changes in |