From 754687fd75a226cb5a3a46d92b8c48e589a59a54 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 14 Feb 2009 16:31:42 -0500 Subject: Read and write in binary mode for everything. --- modules/lua/commands.lua | 5 ++--- modules/textadept/macros.lua | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/lua/commands.lua b/modules/lua/commands.lua index 0b918087..47e872e0 100644 --- a/modules/lua/commands.lua +++ b/modules/lua/commands.lua @@ -55,11 +55,10 @@ function goto_required() end if not file then return end file = file:sub(2, -2):gsub('%.', '/') + local lfs = require 'lfs' for path in package.path:gmatch('[^;]+') do path = path:gsub('?', file) - local f = io.open(path) - if f then - f:close() + if lfs.attributes(file) then textadept.io.open(path) break end diff --git a/modules/textadept/macros.lua b/modules/textadept/macros.lua index 80a89d0f..f45e1fa2 100644 --- a/modules/textadept/macros.lua +++ b/modules/textadept/macros.lua @@ -147,7 +147,7 @@ end -- @param filename The absolute path to the file to save the macros to. function save(filename) if not filename then filename = MACRO_FILE end - local f = assert(io.open(filename, 'w')) + local f = assert(io.open(filename, 'wb')) for name, macro in pairs(list) do f:write(name, '\n') for _, command in ipairs(macro) do @@ -170,7 +170,7 @@ end -- @param filename The absolute path to the file to load the macros from. function load(filename) if not filename then filename = MACRO_FILE end - local f = io.open(filename) + local f = io.open(filename, 'rb') if not f then return end local name, current_macro for line in f:lines() do -- cgit v1.2.3