diff options
author | 2009-02-14 16:31:42 -0500 | |
---|---|---|
committer | 2009-02-14 16:31:42 -0500 | |
commit | 754687fd75a226cb5a3a46d92b8c48e589a59a54 (patch) | |
tree | 9e2f716a1f90533205d3dacd54606d4a648a01f5 /core | |
parent | 6fc95cc3a1df42d81f24d1a912bcaec952db62d4 (diff) | |
download | textadept-754687fd75a226cb5a3a46d92b8c48e589a59a54.tar.gz textadept-754687fd75a226cb5a3a46d92b8c48e589a59a54.zip |
Read and write in binary mode for everything.
Diffstat (limited to 'core')
-rw-r--r-- | core/ext/pm/ctags_browser.lua | 4 | ||||
-rw-r--r-- | core/ext/pm/modules_browser.lua | 6 | ||||
-rw-r--r-- | core/ext/pm/project_browser.lua | 6 | ||||
-rw-r--r-- | core/file_io.lua | 10 | ||||
-rw-r--r-- | core/init.lua | 2 |
5 files changed, 14 insertions, 14 deletions
diff --git a/core/ext/pm/ctags_browser.lua b/core/ext/pm/ctags_browser.lua index 7039d1c4..01f8cc12 100644 --- a/core/ext/pm/ctags_browser.lua +++ b/core/ext/pm/ctags_browser.lua @@ -117,13 +117,13 @@ function get_contents_for(full_path, expanding) current_file = nil current_dir = '' -- ctags file will specify absolute paths os.execute('ctags -f '..FILE_OUT..' '..(buffer.filename or '')) - f = io.open(FILE_OUT) + f = io.open(FILE_OUT, 'rb') if not f then return {} end elseif not expanding then tags = {} current_file = ctags_file current_dir = ctags_file:match('^.+/') -- ctags file dirname - f = io.open(ctags_file) + f = io.open(ctags_file, 'rb') if not f then return {} end else local parent = tags diff --git a/core/ext/pm/modules_browser.lua b/core/ext/pm/modules_browser.lua index 2fbef945..fada137b 100644 --- a/core/ext/pm/modules_browser.lua +++ b/core/ext/pm/modules_browser.lua @@ -141,17 +141,17 @@ function perform_menu_action(menu_id, selected_item) local module_dir = _HOME..'/modules/'..module_name if lfs.mkdir(module_dir) then -- write init.lua from template - local f = io.open(module_dir..'/init.lua', 'w') + local f = io.open(module_dir..'/init.lua', 'wb') local out = INIT:gsub('$1', module_name):gsub('$2', lang_name) f:write(out) f:close() -- write snippets.lua from template - f = io.open(module_dir..'/snippets.lua', 'w') + f = io.open(module_dir..'/snippets.lua', 'wb') out = SNIPPETS:gsub('$1', module_name):gsub('$2', lang_name) f:write(out) f:close() -- write commands.lua from template - f = io.open(module_dir..'/commands.lua', 'w') + f = io.open(module_dir..'/commands.lua', 'wb') out = COMMANDS:gsub('$1', module_name):gsub('$2', lang_name) f:write(out) f:close() diff --git a/core/ext/pm/project_browser.lua b/core/ext/pm/project_browser.lua index 30616ef9..f034e41c 100644 --- a/core/ext/pm/project_browser.lua +++ b/core/ext/pm/project_browser.lua @@ -179,7 +179,7 @@ function perform_menu_action(menu_id, selected_item) if ret == '3' then return end end end - local f = io.open(file, 'w') + local f = io.open(file, 'wb') f:write('') f:close() update_project() @@ -412,7 +412,7 @@ end -- Sets the local 'project_file' and 'project' fields appropriately. -- @param file The project file. load_project = function(file) - local f = io.open(file) + local f = io.open(file, 'rb') project_root = loadstring('return '..f:read('*all'))() f:close() project_file = file @@ -436,7 +436,7 @@ update_project = function() end end end - local f = io.open(project_file, 'w') + local f = io.open(project_file, 'wb') f:write('{\n') write_folder(project_root, f) f:write('}') 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 = diff --git a/core/init.lua b/core/init.lua index bf272496..b6d04424 100644 --- a/core/init.lua +++ b/core/init.lua @@ -12,7 +12,7 @@ end _THEME = 'light' local user_dir = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE') if user_dir then - local f = io.open(user_dir..'/.ta_theme') + local f = io.open(user_dir..'/.ta_theme', 'rb') if f then theme = f:read('*line'):match('[^\r\n]+') f:close() |