1
0
mirror of https://github.com/kepler155c/opus synced 2025-10-18 17:27:39 +00:00

remove dependency on device global

This commit is contained in:
kepler155c@gmail.com
2019-03-11 23:48:22 -04:00
parent bd9b2825be
commit 04af12b452
3 changed files with 11 additions and 10 deletions

View File

@@ -8,7 +8,6 @@ local Util = require('util')
local _rep = string.rep
local _sub = string.sub
local colors = _G.colors
local device = _G.device
local fs = _G.fs
local os = _G.os
local peripheral = _G.peripheral
@@ -914,9 +913,9 @@ UI.Device.defaults = {
function UI.Device:postInit()
self.device = self.device or term.current()
if self.deviceType then
self.device = device[self.deviceType]
end
--if self.deviceType then
-- self.device = device[self.deviceType]
--end
if not self.device.setTextScale then
self.device.setTextScale = function() end
@@ -1197,6 +1196,7 @@ end
loadComponents()
UI.theme = { }
UI:loadTheme('usr/config/ui.theme')
if Util.getVersion() >= 1.76 then
UI:loadTheme('sys/etc/ext.theme')

View File

@@ -404,6 +404,10 @@ function Util.readFile(fname)
end
end
function Util.backupFile(fname)
fs.copy(fname, fname .. '.bak')
end
function Util.writeFile(fname, data)
if not fname or not data then error('Util.writeFile: invalid parameters', 2) end
local file = io.open(fname, "w")