Skip to content

Instantly share code, notes, and snippets.

@cuttlebit
Created January 10, 2015 10:26
Show Gist options
  • Save cuttlebit/3c43c7a2a8cc01223022 to your computer and use it in GitHub Desktop.
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 "/".
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