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.
Is there an equivalent for $PATH in CraftOs?
Started by lincore, Dec 12 2012 11:28 PM
6 replies to this topic
#1
Posted 12 December 2012 - 11:28 PM
#2
Posted 13 December 2012 - 12:25 AM
I could adapt loadreq to that; in fact I'm gonna do it.
#3
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.:
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,...)
]]
#4
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
#7
Posted 14 December 2012 - 10:35 PM
KaoS, on 13 December 2012 - 02:30 AM, said:
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
CoolisTheName007, on 13 December 2012 - 05:39 AM, said:
[...]
How dumb of me to misinterpret the whole thing..
How dumb of me to misinterpret the whole thing..
Thanks for trying to help me out.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











