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

Open A Folder

Started by jonathan, 08 February 2012 - 06:58 PM
jonathan #1
Posted 08 February 2012 - 07:58 PM
hello, I know that if I write "cd rom/programs/…" I can open a folder in "programs"
now I would like to create one program that opens one folder where all my own programs are stored, what are the commands for that?

thanks for answers
Mads #2
Posted 08 February 2012 - 08:00 PM
Can you specify it a little please?
jonathan #3
Posted 08 February 2012 - 08:56 PM
i simply want to write a .lua file that i can place in programs and that opens a folder by itself
Espen #4
Posted 09 February 2012 - 12:57 AM
But what is it supposed to do, after it has 'opened' a folder?
And what exactly do you mean with 'open' a folder?
You mean, instead of having to type "cd /myfolder/is/really/deep/down" you simply want to type "go" and it will take you directly into "/myfolder/is/really/deep/down" without you having to type so much?
If yes, then that's pretty straightforward:

local path = "/my/folder/is/buried/really/deep/below"
shell.setDir( path )
Save that in a file WITHOUT any extension! I.e. no '.lua' or anything else!
jonathan #5
Posted 09 February 2012 - 12:59 AM
That is exactly what i wanted to know, thank you.