2017-09-06 01:21:43 +00:00
|
|
|
local Opus = { }
|
|
|
|
|
2017-09-26 05:40:02 +00:00
|
|
|
local function runDir(directory, open)
|
2017-09-06 01:21:43 +00:00
|
|
|
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
|
2017-09-26 03:18:36 +00:00
|
|
|
if term.isColor() then
|
|
|
|
term.setTextColor(colors.green)
|
|
|
|
end
|
2017-09-26 02:49:44 +00:00
|
|
|
term.write('[PASS] ')
|
|
|
|
term.setTextColor(colors.white)
|
|
|
|
term.write(fs.combine(directory, file))
|
|
|
|
else
|
2017-09-26 03:18:36 +00:00
|
|
|
if term.isColor() then
|
|
|
|
term.setTextColor(colors.red)
|
|
|
|
end
|
2017-09-26 02:49:44 +00:00
|
|
|
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.loadServices()
|
2017-09-26 05:40:02 +00:00
|
|
|
return runDir('sys/services', shell.openHiddenTab)
|
2017-09-06 01:21:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function Opus.autorun()
|
2017-09-26 05:40:02 +00:00
|
|
|
local s = runDir('sys/autorun', shell.run)
|
|
|
|
return runDir('usr/autorun', shell.run) and s
|
2017-09-06 01:21:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
return Opus
|