1
0
mirror of https://github.com/kepler155c/opus synced 2024-12-28 01:20:27 +00:00
opus/sys/apis/opus.lua
kepler155c@gmail.com 9f5c58cc4c web run applications
2017-09-05 21:21:43 -04:00

39 lines
782 B
Lua

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
print(desc .. file)
os.sleep(0)
local result, err = open(directory .. '/' .. file)
if not result then
printError(err)
success = false
end
end
return success
end
function Opus.loadExtensions()
return runDir('sys/extensions', '[ ext ] ', shell.run)
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