749 posts
Location
BOO!!
Posted 18 March 2016 - 06:33 PM
I am making a program and it needs to be accessable no matter what dir you are in. Here's what I tried:
shell.setAlias('lastDir',self)
Edited on 18 March 2016 - 05:36 PM
212 posts
Location
Somewhere in this dimension... I think.
Posted 18 March 2016 - 06:44 PM
The command you tried works (apart from the self which in this instance can be replaced with fs.getRunningProgram() )
1023 posts
Posted 18 March 2016 - 07:19 PM
The command you tried works (apart from the self which in this instance can be replaced with fs.getRunningProgram() )
shell.getRunningProgram()*
570 posts
Posted 18 March 2016 - 09:47 PM
A much more conventional way to do it would be to modify the path:
local programDir = "/dir/containing/the/program"
shell.setPath(shell.path() .. ":" .. programDir)
212 posts
Location
Somewhere in this dimension... I think.
Posted 18 March 2016 - 10:29 PM
A much more conventional way to do it would be to modify the path:
local programDir = "/dir/containing/the/program"
shell.setPath(shell.path() .. ":" .. programDir)
That defeats the point of being inside any directory. Especially since it has to be run programatically then
570 posts
Posted 19 March 2016 - 03:39 PM
That defeats the point of being inside any directory. Especially since it has to be run programatically then
My code will make the program executable from inside any directory, which is the point, no? I'm afraid I'm also not sure what you mean by having to programmatically run it.
212 posts
Location
Somewhere in this dimension... I think.
Posted 19 March 2016 - 05:18 PM
Didn't realize that functionality, although my previous point that a program would have to run it stands. Plus it is easier to read and clear aliases since they are in a table not a long string. (Although that may just be my opinion)
570 posts
Posted 19 March 2016 - 07:04 PM
Didn't realize that functionality, although my previous point that a program would have to run it stands. Plus it is easier to read and clear aliases since they are in a table not a long string. (Although that may just be my opinion)
Well, the alias version would still have to be run. I do agree that for a single program an alias would be sufficient, though it seems to me like a bit of a hack, since they're not meant for that sort of stuff.