This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Zitrone77's profile picture

[SOLVED] shell.run("PATH")..

Started by Zitrone77, 06 March 2012 - 01:43 PM
Zitrone77 #1
Posted 06 March 2012 - 02:43 PM
My question:
I know the shell.run("PATH") funcion.
BUT- Can somebody explain to me how it EXACTLY works?!
With EXACTLY i mean thing like:
- from where it acts
- if there is a way to go back one direction/folder, how?

Why this question:
I need a way to open programs located in:
"/.minecraft/ComputerCraft/lua/rom/programs"


Thanks
-Zitrone77
Espen #2
Posted 06 March 2012 - 02:56 PM
When you say you need a way to open programs, do you mean run them?

If that's the case:
shell.run("programname") will internally first resolve the absolute path of the program you provided.
It literally performs shell.resolveProgram() on your parameter ).
That means if "programname" is in "/rom/programs", then shell.run() will know that.
Finally it will run resolved Path + "prorgamname" ( in this case "/rom/programs/programname" ).

So the only thing you need to worry about is the program name and run it like this:
shell.run( "calculator" )

But if you want, then you can be more specific and provide a path for it to look for your program:
shell.run( "/my/secret/folder/programOfDoom" )

One last thing, in case you didn't know:
The root of any specific computer is the number-folder that represents its ID within this directory:
/.minecraft/saves/YOURWORLD/computercraft/
The rom-folder for all computers is here:
/.minecraft/ComputerCraft/lua/rom/
Edited on 06 March 2012 - 02:00 PM
Zitrone77 #3
Posted 06 March 2012 - 07:29 PM
When you say you need a way to open programs, do you mean run them?
Yep!

The rom-folder for all computers is here:
/.minecraft/ComputerCraft/lua/rom/
Yep! i know this too. But ist there a way to run a program located in:
/.minecraft/ComputerCraft/lua/rom/
with 'shell.tun("PATH")'?
MysticT #4
Posted 06 March 2012 - 07:33 PM
I think that just doing shell.run("/rom/Program") will work. I'll check…

EDIT: yep, it works :unsure:/>/>
Zitrone77 #5
Posted 06 March 2012 - 07:40 PM
I think that just doing shell.run("/rom/Program") will work. I'll check…

EDIT: yep, it works :unsure:/>/>

Thanks very much!!

*Voted you up*
Espen #6
Posted 06 March 2012 - 08:36 PM
When you say you need a way to open programs, do you mean run them?
Yep!

The rom-folder for all computers is here:
/.minecraft/ComputerCraft/lua/rom/
Yep! i know this too. But ist there a way to run a program located in:
/.minecraft/ComputerCraft/lua/rom/
with 'shell.tun("PATH")'?
So you didn't read the first part of my post? :unsure:/>/>
Zitrone77 #7
Posted 06 March 2012 - 08:44 PM
When you say you need a way to open programs, do you mean run them?
Yep!

The rom-folder for all computers is here:
/.minecraft/ComputerCraft/lua/rom/
Yep! i know this too. But ist there a way to run a program located in:
/.minecraft/ComputerCraft/lua/rom/
with 'shell.tun("PATH")'?
So you didn't read the first part of my post? :unsure:/>/>
I did! But i dindn't get everything! But now it's solved anyway. Thanks to everybody!
Sebra #8
Posted 12 March 2012 - 03:21 PM
The rom-folder for all computers is here:
/.minecraft/ComputerCraft/lua/rom/
Wrong!
real path will be .../.minecraft/mods/ComputerCraft/lua/rom/
Espen #9
Posted 12 March 2012 - 09:38 PM
The rom-folder for all computers is here:
/.minecraft/ComputerCraft/lua/rom/
Wrong!
real path will be .../.minecraft/mods/ComputerCraft/lua/rom/
You're absolutely right, I totally forgot that one, but crucial, folder. My bad, thanks for calling this to attention. :mellow:/>/>