path fix + compat changes
This commit is contained in:
@@ -139,7 +139,7 @@ end
|
|||||||
term.clear()
|
term.clear()
|
||||||
term.setCursorPos(1, 1)
|
term.setCursorPos(1, 1)
|
||||||
if bootOptions[bootOption].args then
|
if bootOptions[bootOption].args then
|
||||||
os.run({}, table.unpack(bootOptions[bootOption].args))
|
os.run(_ENV, table.unpack(bootOptions[bootOption].args))
|
||||||
else
|
else
|
||||||
print(bootOptions[bootOption].prompt)
|
print(bootOptions[bootOption].prompt)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ end
|
|||||||
if not fs.exists('usr/config/shell') then
|
if not fs.exists('usr/config/shell') then
|
||||||
Util.writeTable('usr/config/shell', {
|
Util.writeTable('usr/config/shell', {
|
||||||
aliases = shell.aliases(),
|
aliases = shell.aliases(),
|
||||||
path = 'usr/apps',
|
path = '/usr/apps',
|
||||||
lua_path = package.path,
|
lua_path = package.path,
|
||||||
upgraded = 1,
|
upgraded = 1,
|
||||||
})
|
})
|
||||||
@@ -36,7 +36,7 @@ if config.aliases then
|
|||||||
end
|
end
|
||||||
|
|
||||||
local path = config.path and Util.split(config.path, '(.-):') or { }
|
local path = config.path and Util.split(config.path, '(.-):') or { }
|
||||||
table.insert(path, 'sys/apps')
|
table.insert(path, '/sys/apps')
|
||||||
for _, v in pairs(Util.split(shell.path(), '(.-):')) do
|
for _, v in pairs(Util.split(shell.path(), '(.-):')) do
|
||||||
table.insert(path, v)
|
table.insert(path, v)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ table.insert(helpPaths, '/sys/help')
|
|||||||
for name in pairs(Packages:installed()) do
|
for name in pairs(Packages:installed()) do
|
||||||
local packageDir = fs.combine('packages', name)
|
local packageDir = fs.combine('packages', name)
|
||||||
|
|
||||||
table.insert(appPaths, 1, packageDir)
|
table.insert(appPaths, 1, '/' .. packageDir)
|
||||||
local apiPath = fs.combine(packageDir, 'apis')
|
local apiPath = fs.combine(packageDir, 'apis')
|
||||||
if fs.exists(apiPath) then
|
if fs.exists(apiPath) then
|
||||||
fs.mount(fs.combine('rom/modules/main', name), 'linkfs', apiPath)
|
fs.mount(fs.combine('rom/modules/main', name), 'linkfs', apiPath)
|
||||||
|
|||||||
@@ -490,7 +490,7 @@ function Util.loadTable(fname)
|
|||||||
if not fc then
|
if not fc then
|
||||||
return false, 'Unable to read file'
|
return false, 'Unable to read file'
|
||||||
end
|
end
|
||||||
local s, m = load('return ' .. fc, fname)
|
local s, m = loadstring('return ' .. fc, fname)
|
||||||
if s then
|
if s then
|
||||||
s, m = pcall(s)
|
s, m = pcall(s)
|
||||||
if s then
|
if s then
|
||||||
@@ -551,9 +551,8 @@ function Util.run(env, path, ...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Util.runFunction(env, fn, ...)
|
function Util.runFunction(env, fn, ...)
|
||||||
--setfenv(fn, env)
|
setfenv(fn, env)
|
||||||
setmetatable(env, { __index = _G })
|
setmetatable(env, { __index = _G })
|
||||||
fn = load(fn,"util.runfunction",nil,env)
|
|
||||||
return pcall(fn, ...)
|
return pcall(fn, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user