Created
January 10, 2015 10:26
-
-
Save cuttlebit/3c43c7a2a8cc01223022 to your computer and use it in GitHub Desktop.
Modification of cd.lua behaviour in Open Computers. Calling cd with no arguments defaults to root "/".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local shell = require("shell") | |
local args = shell.parse(...) | |
local result, reason | |
if #args == 0 then | |
result, reason = shell.setWorkingDirectory("/") | |
else | |
result, reason = shell.setWorkingDirectory(shell.resolve(args[1])) | |
end | |
if not result then | |
io.stderr:write(reason) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment