1
0
mirror of https://github.com/kepler155c/opus synced 2024-11-16 05:34:49 +00:00
opus/sys/apis/opus.lua

51 lines
1.1 KiB
Lua
Raw Normal View History

2017-09-06 01:21:43 +00:00
local Opus = { }
local function runDir(directory, desc, open)
if not fs.exists(directory) then
return true
end
local success = true
local files = fs.list(directory)
table.sort(files)
for _,file in ipairs(files) do
os.sleep(0)
local result, err = open(directory .. '/' .. file)
2017-09-26 02:49:44 +00:00
if result then
term.setTextColor(colors.green)
term.write('[PASS] ')
term.setTextColor(colors.white)
term.write(fs.combine(directory, file))
else
term.setTextColor(colors.red)
term.write('[FAIL] ')
term.setTextColor(colors.white)
term.write(fs.combine(directory, file))
if err then
printError(err)
end
2017-09-06 01:21:43 +00:00
success = false
end
2017-09-26 02:49:44 +00:00
print()
2017-09-06 01:21:43 +00:00
end
return success
end
function Opus.loadExtensions()
2017-09-25 21:00:02 +00:00
--return runDir('sys/extensions', '[ ext ] ', shell.run)
return true
2017-09-06 01:21:43 +00:00
end
function Opus.loadServices()
return runDir('sys/services', '[ svc ] ', shell.openHiddenTab)
end
function Opus.autorun()
local s = runDir('sys/autorun', '[ aut ] ', shell.run)
return runDir('usr/autorun', '[ aut ] ', shell.run) and s
end
return Opus