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

package manager wip

This commit is contained in:
kepler155c@gmail.com
2018-10-20 20:35:48 -04:00
parent 8b50127f21
commit b7176e55ad
4 changed files with 87 additions and 0 deletions

32
sys/apis/packages.lua Normal file
View File

@@ -0,0 +1,32 @@
_G.requireInjector(_ENV)
local Util = require('util')
local fs = _G.fs
local PACKAGE_DIR = 'packages'
local Packages = { }
function Packages:installed()
self.cache = { }
if fs.exists(PACKAGE_DIR) then
for _, dir in pairs(fs.list(PACKAGE_DIR)) do
local path = fs.combine(fs.combine(PACKAGE_DIR, dir), '.package')
self.cache[dir] = Util.readTable(path)
end
end
return self.cache
end
function Packages:list()
return Util.readTable('sys/packageList.lua') or { }
end
function Packages:isInstalled(package)
return self:installed()[package]
end
return Packages