aboutsummaryrefslogtreecommitdiffhomepage
path: root/core/file_io.lua
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-02-14 16:31:42 -0500
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2009-02-14 16:31:42 -0500
commit754687fd75a226cb5a3a46d92b8c48e589a59a54 (patch)
tree9e2f716a1f90533205d3dacd54606d4a648a01f5 /core/file_io.lua
parent6fc95cc3a1df42d81f24d1a912bcaec952db62d4 (diff)
Read and write in binary mode for everything.
Diffstat (limited to 'core/file_io.lua')
-rw-r--r--core/file_io.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/core/file_io.lua b/core/file_io.lua
index 7500667c..59017b64 100644
--- a/core/file_io.lua
+++ b/core/file_io.lua
@@ -76,7 +76,7 @@ end
function reload(buffer)
textadept.check_focused_buffer(buffer)
if not buffer.filename then return end
- local f, err = io.open(buffer.filename)
+ local f, err = io.open(buffer.filename, 'rb')
if f then
local pos = buffer.current_pos
local first_visible_line = buffer.first_visible_line
@@ -196,7 +196,7 @@ function load_session(filename, only_pm)
local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE')
if not user_dir then return end
local ta_session = user_dir..'/.ta_session'
- local f = io.open(filename or ta_session)
+ local f = io.open(filename or ta_session, 'rb')
local current_view, splits = 1, { [0] = {} }
if f then
for line in f:lines() do
@@ -204,7 +204,7 @@ function load_session(filename, only_pm)
if line:find('^buffer:') then
local anchor, current_pos, first_visible_line, filename =
line:match('^buffer: (%d+) (%d+) (%d+) (.+)$')
- textadept.io.open(filename or '')
+ textadept.io.open(filename or '', 'rb')
-- Restore saved buffer selection and view.
local anchor = tonumber(anchor) or 0
local current_pos = tonumber(current_pos) or 0
@@ -314,7 +314,7 @@ function save_session(filename)
local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE')
if not user_dir then return end
local ta_session = user_dir..'/.ta_session'
- local f = io.open(filename or ta_session, 'w')
+ local f = io.open(filename or ta_session, 'wb')
if f then
f:write(table.concat(session, '\n'))
f:close()
@@ -336,7 +336,7 @@ end
-- @usage textadept.io.read_api_file(filename, '%w_')
function read_api_file(filename, word_chars)
local api = {}
- local f = io.open(filename)
+ local f = io.open(filename, 'rb')
if f then
for line in f:lines() do
local func, params, desc =