fix lua path, mwm, cleanup injector

This commit is contained in:
kepler155c@gmail.com
2019-02-07 03:10:05 -05:00
parent 915085ac5f
commit 53e0fa3795
14 changed files with 342 additions and 145 deletions

View File

@@ -10,30 +10,14 @@ if not fs.exists('usr/config/packages') then
end
local appPaths = Util.split(shell.path(), '(.-):')
local luaPaths = Util.split(_G.LUA_PATH, '(.-);')
local helpPaths = Util.split(help.path(), '(.-):')
table.insert(helpPaths, '/sys/help')
local function addEntry(t, e, n)
for _,v in ipairs(t) do
if v == e then
return true
end
end
table.insert(t, n or 1, e)
end
for name in pairs(Packages:installed()) do
local packageDir = fs.combine('packages', name)
if fs.exists(fs.combine(packageDir, '.install')) then
local install = Util.readTable(fs.combine(packageDir, '.install'))
if install and install.mount then
fs.mount(table.unpack(Util.matches(install.mount)))
end
end
addEntry(appPaths, packageDir)
table.insert(appPaths, 1, packageDir)
local apiPath = fs.combine(fs.combine('packages', name), 'apis')
if fs.exists(apiPath) then
fs.mount(fs.combine('sys/apis', name), 'linkfs', apiPath)
@@ -47,4 +31,3 @@ end
help.setPath(table.concat(helpPaths, ':'))
shell.setPath(table.concat(appPaths, ':'))
_G.LUA_PATH = table.concat(luaPaths, ';')