mirror of
https://github.com/kepler155c/opus
synced 2025-10-14 07:17:40 +00:00
require rework round 3
This commit is contained in:
@@ -44,6 +44,8 @@ for _, v in pairs(Util.split(shell.path(), '(.-):')) do
|
||||
end
|
||||
|
||||
shell.setPath(table.concat(path, ':'))
|
||||
_G.LUA_PATH = config.lua_path
|
||||
-- TODO: replace when stable (old lua path is now incorrect)
|
||||
-- _G.LUA_PATH = config.lua_path
|
||||
_G.LUA_PATH = package.path
|
||||
|
||||
fs.loadTab('usr/config/fstab')
|
||||
|
||||
@@ -24,12 +24,6 @@ local function addEntry(t, e, n)
|
||||
table.insert(t, n or 1, e)
|
||||
end
|
||||
|
||||
local function addRequirePath(t, path)
|
||||
addEntry(t, string.format('/%s/?/init.lua', path), 7)
|
||||
addEntry(t, string.format('/%s/?.lua', path), 7)
|
||||
addEntry(t, string.format('/%s/?', path), 7)
|
||||
end
|
||||
|
||||
for name in pairs(Packages:installed()) do
|
||||
local packageDir = fs.combine('packages', name)
|
||||
if fs.exists(fs.combine(packageDir, '.install')) then
|
||||
@@ -42,7 +36,7 @@ for name in pairs(Packages:installed()) do
|
||||
addEntry(appPaths, packageDir)
|
||||
local apiPath = fs.combine(fs.combine('packages', name), 'apis')
|
||||
if fs.exists(apiPath) then
|
||||
addRequirePath(luaPaths, apiPath)
|
||||
fs.mount(fs.combine('sys/apis', name), 'linkfs', apiPath)
|
||||
end
|
||||
|
||||
local helpPath = '/' .. fs.combine(fs.combine('packages', name), 'help')
|
||||
|
||||
Reference in New Issue
Block a user