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

Find current working directory

Started by cmdpwnd, 10 October 2015 - 10:15 PM
cmdpwnd #1
Posted 11 October 2015 - 12:15 AM
In a program how can I find the directory that the file being executed is in?

>ls test
file1.lua file2.lua
>test/file2.lua
Current Dir: test/
>
>
Edited on 10 October 2015 - 10:15 PM
Lyqyd #2
Posted 11 October 2015 - 12:18 AM
The best bet is shell.getRunningProgram(), then fs.getDir() on the value it returns.
cmdpwnd #3
Posted 11 October 2015 - 12:23 AM
great thnx :)/>