1
0
mirror of https://github.com/kepler155c/opus synced 2025-02-02 18:39:09 +00:00

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 if button == 1 and shift and control then -- hack
local event = self:pointToChild(self.target, x, y) 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 elseif self.currentPage then
if not self.currentPage.parent.device.side then if not self.currentPage.parent.device.side then

View File

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

View File

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

View File

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

View File

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

View File

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