11 posts
Posted 12 December 2012 - 11:28 PM
So I got into cc recently and I'm having a blast so far, but I'm wondering: Is there a way to execute programs without either traversing the directory tree or specifying the path?
Ideally I'd like to have a list of directories that the shell checks for an executable by the given name.
302 posts
Posted 13 December 2012 - 12:25 AM
I could adapt loadreq to that; in fact I'm gonna do it.
302 posts
Posted 13 December 2012 - 01:12 AM
Ok, updated the loadreq with a simple function and some changes that allow to use it to run files as normally.
E.g.:
---runs filepath path with args ... using the same rules as @require for determining the globs to uses
--e.g.
--[[
os.loadAPI('APIS/loadreq')
loadreq.vars.paths=loadreq.vars.paths..';myFolder'
--or
REQUIRE_PATH='myFolder'
--ect
loadreq.run_lua('subFolder/subsubFolder/myFile.lua',arg1,arg2,...)
]]
1548 posts
Location
That dark shadow under your bed...
Posted 13 December 2012 - 02:30 AM
use the command shell.setPath(dirs separated by ';'s ) it is the equivalent of %path% in cmd
local function add(dir)
if fs.exists(dir) and fs.iDir(dir) then
shell.setPath(shell.getPath..';'..shell.resolve(dir))
end
end
302 posts
Posted 13 December 2012 - 05:39 AM
snip
How dumb of me to misinterpret the whole thing.. :blink:/>
1548 posts
Location
That dark shadow under your bed...
Posted 13 December 2012 - 06:44 AM
snip
we all derp. chilled stuff
11 posts
Posted 14 December 2012 - 10:35 PM
use the command shell.setPath(dirs separated by ';'s ) it is the equivalent of %path% in cmd
local function add(dir)
if fs.exists(dir) and fs.iDir(dir) then
shell.setPath(shell.getPath..';'..shell.resolve(dir))
end
end
Just what I was looking for, thank you!
[…]
How dumb of me to misinterpret the whole thing.. :blink:/>
After all we're only humans == derpy :~)
Thanks for trying to help me out.