binary support fixes

This commit is contained in:
kepler155c@gmail.com 2020-06-01 16:53:01 -06:00
parent 4796e9e77a
commit 5c4ab57ec8
7 changed files with 15 additions and 7 deletions

View File

@ -669,6 +669,10 @@ if settings.get("motd.enabled") then
end
while not bExit do
local cx = term.getCursorPos()
if cx ~= 1 then
print()
end
if config.displayDirectory then
term.setTextColour(_colors.directoryTextColor)
term.setBackgroundColor(_colors.directoryBackgroundColor)

View File

@ -223,12 +223,12 @@ function fs.copy(s, t)
end
else
local sf = Util.readFile(s)
local sf = Util.readFile(s, 'rb')
if not sf then
error('No such file')
end
Util.writeFile(t, sf)
Util.writeFile(t, sf, 'wb')
end
end
@ -378,4 +378,4 @@ function fs.restore()
local native = fs.native
Util.clear(fs)
Util.merge(fs, native)
end
end

View File

@ -43,4 +43,4 @@ end
-- non-standard - will raise error instead
os.exit = function(code)
error(code or 0)
end
end

View File

@ -72,4 +72,4 @@ function linkfs.move(node, s, t)
return fs.move(s, t)
end
return linkfs
return linkfs

View File

@ -154,6 +154,9 @@ function ramfs.open(node, fn, fl)
local ctr = 0
return {
readAll = function()
return string.char(table.unpack(c))
end,
read = function(n)
if n and n > 1 and ctr < node.size then
-- some programs open in rb, when it should have

View File

@ -32,6 +32,7 @@ function UI.Tabs:add(children)
if not self.tabBar then
self.tabBar = UI.TabBar({
buttons = buttons,
backgroundColor = self.barBackgroundColor,
})
else
self.tabBar:addButtons(buttons)

View File

@ -493,7 +493,7 @@ function Util.backup(fname)
fs.copy(fname, backup)
end
function Util.writeFile(fname, data)
function Util.writeFile(fname, data, flags)
if not fname or not data then error('Util.writeFile: invalid parameters', 2) end
if fs.exists(fname) then
@ -505,7 +505,7 @@ function Util.writeFile(fname, data)
end
end
local file = io.open(fname, "w")
local file = io.open(fname, flags or "w")
if not file then
error('Unable to open ' .. fname, 2)
end