Jump to content




Add program to global programs list


  • You cannot reply to this topic
7 replies to this topic

#1 EveryOS

  • Members
  • 570 posts
  • LocationOver there ->

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 by everyOS, 18 March 2016 - 06:36 PM.


#2 TYKUHN2

  • Members
  • 210 posts
  • LocationSomewhere 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() )

#3 valithor

  • Members
  • 1,053 posts

Posted 18 March 2016 - 07:19 PM

 TYKUHN2, on 18 March 2016 - 06:44 PM, said:

The command you tried works (apart from the self which in this instance can be replaced with fs.getRunningProgram() )

shell.getRunningProgram()*

#4 Lignum

  • Members
  • 558 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)


#5 TYKUHN2

  • Members
  • 210 posts
  • LocationSomewhere in this dimension... I think.

Posted 18 March 2016 - 10:29 PM

 Lignum, on 18 March 2016 - 09:47 PM, said:

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

#6 Lignum

  • Members
  • 558 posts

Posted 19 March 2016 - 03:39 PM

 TYKUHN2, on 18 March 2016 - 10:29 PM, said:

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.

#7 TYKUHN2

  • Members
  • 210 posts
  • LocationSomewhere 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)

#8 Lignum

  • Members
  • 558 posts

Posted 19 March 2016 - 07:04 PM

 TYKUHN2, on 19 March 2016 - 05:18 PM, said:

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users