From 5c4ab57ec8fe06879adf38c7edb3c447c1f242df Mon Sep 17 00:00:00 2001 From: "kepler155c@gmail.com" Date: Mon, 1 Jun 2020 16:53:01 -0600 Subject: [PATCH] binary support fixes --- sys/apps/shell.lua | 4 ++++ sys/init/2.vfs.lua | 6 +++--- sys/init/3.sys.lua | 2 +- sys/modules/opus/fs/linkfs.lua | 2 +- sys/modules/opus/fs/ramfs.lua | 3 +++ sys/modules/opus/ui/components/Tabs.lua | 1 + sys/modules/opus/util.lua | 4 ++-- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/sys/apps/shell.lua b/sys/apps/shell.lua index 4f8d659..d0002ce 100644 --- a/sys/apps/shell.lua +++ b/sys/apps/shell.lua @@ -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) diff --git a/sys/init/2.vfs.lua b/sys/init/2.vfs.lua index 816f38f..4734981 100644 --- a/sys/init/2.vfs.lua +++ b/sys/init/2.vfs.lua @@ -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 \ No newline at end of file diff --git a/sys/init/3.sys.lua b/sys/init/3.sys.lua index 5a5583a..3f73c6d 100644 --- a/sys/init/3.sys.lua +++ b/sys/init/3.sys.lua @@ -43,4 +43,4 @@ end -- non-standard - will raise error instead os.exit = function(code) error(code or 0) -end +end \ No newline at end of file diff --git a/sys/modules/opus/fs/linkfs.lua b/sys/modules/opus/fs/linkfs.lua index 813ce5f..7a98b77 100644 --- a/sys/modules/opus/fs/linkfs.lua +++ b/sys/modules/opus/fs/linkfs.lua @@ -72,4 +72,4 @@ function linkfs.move(node, s, t) return fs.move(s, t) end -return linkfs +return linkfs \ No newline at end of file diff --git a/sys/modules/opus/fs/ramfs.lua b/sys/modules/opus/fs/ramfs.lua index bea2370..9c5d718 100644 --- a/sys/modules/opus/fs/ramfs.lua +++ b/sys/modules/opus/fs/ramfs.lua @@ -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 diff --git a/sys/modules/opus/ui/components/Tabs.lua b/sys/modules/opus/ui/components/Tabs.lua index 566993a..93ab9e7 100644 --- a/sys/modules/opus/ui/components/Tabs.lua +++ b/sys/modules/opus/ui/components/Tabs.lua @@ -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) diff --git a/sys/modules/opus/util.lua b/sys/modules/opus/util.lua index ec3c7d6..8dfa148 100644 --- a/sys/modules/opus/util.lua +++ b/sys/modules/opus/util.lua @@ -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