major directory reorganize

This commit is contained in:
kepler155c@gmail.com 2017-05-20 19:05:00 -04:00
parent c8147ef9e8
commit 2266cd9873
16 changed files with 32 additions and 16 deletions

View File

@ -119,7 +119,7 @@ function Manager:init(args)
if button == 1 and shift and control then -- hack
local event = self:pointToChild(self.target, x, y)
multishell.openTab({ path = 'apps/Lua.lua', args = { event.element }, focused = true })
multishell.openTab({ path = 'sys/apps/Lua.lua', args = { event.element }, focused = true })
elseif self.currentPage then
if not self.currentPage.parent.device.side then

View File

@ -287,10 +287,10 @@ function Browser:eventHandler(event)
Event.exitPullEvents()
elseif event.type == 'edit' and file then
self:run('/apps/shell', 'edit', file.name)
self:run('sys/apps/shell', 'edit', file.name)
elseif event.type == 'shell' then
self:run('/apps/shell')
self:run('sys/apps/shell')
elseif event.type == 'refresh' then
self:updateDirectory(self.dir)
@ -339,7 +339,7 @@ function Browser:eventHandler(event)
if file.isDir then
self:setDir(file.fullName)
else
self:run('/apps/shell', file.name)
self:run('sys/apps/shell', file.name)
end
end

View File

@ -65,14 +65,14 @@ function page:eventHandler(event)
if t then
if event.type == 'telnet' or event.type == 'grid_select' then
multishell.openTab({
path = '/apps/telnet.lua',
path = 'sys/apps/telnet.lua',
focused = true,
args = { t.id },
title = t.label,
})
elseif event.type == 'vnc' then
multishell.openTab({
path = '/apps/vnc.lua',
path = 'sys/apps/vnc.lua',
focused = true,
args = { t.id },
title = t.label,

View File

@ -17,7 +17,8 @@ local options = {
desc = 'Displays the options' },
}
local SCRIPTS_PATH = '/apps/scripts'
local USR_SCRIPTS_PATH = 'usr/scripts'
local SYS_SCRIPTS_PATH = 'sys/etc/scripts'
local nullTerm = Terminal.getNullTerm(term.current())
local turtles = { }
@ -153,10 +154,12 @@ function page:runFunction(script, nowrap)
end
function page:runScript(scriptName)
local cmd = string.format('Script %d %s', self.turtle.id, scriptName)
local ot = term.redirect(nullTerm)
pcall(function() shell.run(cmd) end)
term.redirect(ot)
if self.turtle then
local cmd = string.format('Script %d %s', self.turtle.id, scriptName)
local ot = term.redirect(nullTerm)
pcall(function() shell.run(cmd) end)
term.redirect(ot)
end
end
function page.coords:draw()
@ -214,10 +217,24 @@ function page.tabs.inventory:eventHandler(event)
end
function page.tabs.scripts:draw()
local function combineDirs(...)
local list = { }
for _,path in pairs({...}) do
if fs.exists(path) then
local files = fs.list(path)
for _,f in pairs(files) do
list[f] = fs.combine(path, f)
end
end
end
return list
end
Util.clear(self.values)
local files = fs.list(SCRIPTS_PATH)
for _,f in pairs(files) do
table.insert(self.values, { label = f, path = fs.combine(SCRIPTS_PATH, f) })
local files = combineDirs(SYS_SCRIPTS_PATH, USR_SCRIPTS_PATH)
for f,path in pairs(files) do
table.insert(self.values, { label = f, path = path })
end
self:update()
UI.Grid.draw(self)

View File

@ -300,7 +300,6 @@ local function autocompleteFile(results, words)
if fs.isDir(startDir) then
local files = fs.list(startDir)
debug({ rawPath, startDir })
for _,f in pairs(files) do
local path = fs.combine(rawPath, f)
if fs.isDir(fs.combine(startDir, f)) then

View File

@ -36,7 +36,7 @@ local function telnetHost(socket, termInfo)
wrapTerm(socket, termInfo)
local shellThread = process:newThread('shell_wrapper', function()
os.run(getfenv(1), '/apps/shell')
os.run(getfenv(1), 'sys/apps/shell')
socket:close()
end)