mirror of
https://github.com/kepler155c/opus
synced 2025-02-03 19:09:08 +00:00
env cleanup
This commit is contained in:
parent
8cfeaad061
commit
e3a8e4e790
@ -1,7 +1,7 @@
|
||||
local PASTEBIN_URL = 'http://pastebin.com/raw'
|
||||
local GIT_URL = 'https://raw.githubusercontent.com'
|
||||
local DEFAULT_PATH = '/sys/apis/?;/sys/apis/?.lua'
|
||||
local DEFAULT_BRANCH = _ENV.OPUS_BRANCH or _G.OPUS_BRANCH or 'master'
|
||||
local DEFAULT_PATH = (package and (package.path .. ':') or '') .. '/sys/apis/?;/sys/apis/?.lua'
|
||||
local DEFAULT_BRANCH = _ENV.OPUS_BRANCH or _G.OPUS_BRANCH or 'develop-1.8'
|
||||
local DEFAULT_UPATH = GIT_URL .. '/kepler155c/opus/' .. DEFAULT_BRANCH .. '/sys/apis'
|
||||
|
||||
local fs = _G.fs
|
||||
|
@ -2,8 +2,6 @@ local Config = require('config')
|
||||
local UI = require('ui')
|
||||
local Util = require('util')
|
||||
|
||||
local shell = _ENV.shell
|
||||
|
||||
local pathTab = UI.Window {
|
||||
tabTitle = 'Path',
|
||||
description = 'Set the shell path',
|
||||
@ -11,7 +9,7 @@ local pathTab = UI.Window {
|
||||
entry = UI.TextEntry {
|
||||
x = 2, y = 2, ex = -2,
|
||||
limit = 256,
|
||||
value = shell.path(),
|
||||
value = Config.load('shell').path,
|
||||
shadowText = 'enter system path',
|
||||
accelerators = {
|
||||
enter = 'update_path',
|
||||
@ -39,9 +37,9 @@ function pathTab:eventHandler(event)
|
||||
if event.type == 'update_path' then
|
||||
local env = Config.load('shell')
|
||||
env.path = self.entry.value
|
||||
Config.update('shell', env)
|
||||
self.grid:setIndex(self.grid:getIndex())
|
||||
self.grid:draw()
|
||||
Config.update('shell', env)
|
||||
self:emit({ type = 'success_message', message = 'reboot to take effect' })
|
||||
return true
|
||||
end
|
||||
|
@ -11,25 +11,13 @@ end
|
||||
if not fs.exists('usr/autorun') then
|
||||
fs.makeDir('usr/autorun')
|
||||
end
|
||||
--if not fs.exists('usr/config/fstab') then
|
||||
-- Util.writeFile('usr/config/fstab',
|
||||
-- 'usr gitfs kepler155c/opus-apps/' .. _G.OPUS_BRANCH)
|
||||
--end
|
||||
|
||||
local lua_path = '?;?.lua;?/init.lua'
|
||||
lua_path = lua_path .. ';/usr/apis/?;/usr/apis/?.lua'
|
||||
lua_path = lua_path .. ';/sys/apis/?;/sys/apis/?.lua'
|
||||
lua_path = lua_path .. ';/rom/modules/main/?;/rom/modules/main/?.lua;/rom/modules/main/?/init.lua;'
|
||||
if _G.turtle then
|
||||
lua_path = lua_path..';/rom/modules/turtle/?;/rom/modules/turtle/?.lua;/rom/modules/turtle/?/init.lua'
|
||||
elseif _G.command then
|
||||
lua_path = lua_path..';/rom/modules/command/?;/rom/modules/command/?.lua;/rom/modules/command/?/init.lua'
|
||||
end
|
||||
local lua_path = package.path
|
||||
|
||||
if not fs.exists('usr/config/shell') then
|
||||
Util.writeTable('usr/config/shell', {
|
||||
aliases = shell.aliases(),
|
||||
path = 'usr/apps:sys/apps:' .. shell.path(),
|
||||
path = 'usr/apps',
|
||||
lua_path = lua_path,
|
||||
})
|
||||
end
|
||||
@ -54,8 +42,14 @@ if config.aliases then
|
||||
shell.setAlias(k, v)
|
||||
end
|
||||
end
|
||||
shell.setPath(config.path)
|
||||
--_G.LUA_PATH = config.lua_path
|
||||
_G.LUA_PATH = lua_path
|
||||
|
||||
local path = config.path and Util.split(config.path, '(.-):') or { }
|
||||
table.insert(path, 'sys/apps')
|
||||
for _, v in pairs(Util.split(shell.path(), '(.-):')) do
|
||||
table.insert(path, v)
|
||||
end
|
||||
|
||||
shell.setPath(table.concat(path, ':'))
|
||||
_G.LUA_PATH = config.lua_path
|
||||
|
||||
fs.loadTab('usr/config/fstab')
|
||||
|
@ -7,7 +7,7 @@ local fs = _G.fs
|
||||
local help = _G.help
|
||||
local shell = _ENV.shell
|
||||
|
||||
local appPaths = Util.split(shell.path(), '(.-);')
|
||||
local appPaths = Util.split(shell.path(), '(.-):')
|
||||
local luaPaths = Util.split(_G.LUA_PATH, '(.-);')
|
||||
local helpPaths = Util.split(help.path(), '(.-):')
|
||||
|
||||
|
@ -879,7 +879,7 @@ function turtle.condense()
|
||||
if slots[j].count > 0 and (slots[i].count == 0 or slots[i].key == slots[j].key) then
|
||||
turtle.select(j)
|
||||
if turtle.transferTo(i) then
|
||||
local transferred = turtle.getItemCount(i) - slots[i].qty
|
||||
local transferred = turtle.getItemCount(i) - slots[i].count
|
||||
slots[j].count = slots[j].count - transferred
|
||||
slots[i].count = slots[i].count + transferred
|
||||
slots[i].key = slots[j].key
|
||||
|
Loading…
Reference in New Issue
Block a user