Moving to Directory on startup.

Started by thetrue_dv, Mar 07, 2021, 11:42 PM

Previous topic - Next topic

thetrue_dv

Hello!

I like to organise my scripts into folders, that's pretty common...

What I'd like to do is basically run
cd <foldername> upon startup, so I don't have to manually do it every time I break the turtle to move it. How do I go about doing that?

Lupus590

There is an API for changing the current directory of the shell, calling it with the right argument in a startup file will do what you want.

thetrue_dv

Just to confirm:
"shell.setDir("/rom")"?

It works, but working doesn't always mean the best way

Lupus590

Yep. The other way would be to shell.run to the cd program but it's considered bad practice to use shell.run like that.