def do_cd(self, line):
"""Changes the current path.
- Valid arguments: either .. or a child of the current object.
+ Valid arguments: either .., /, "" (no argument) or a child of the current
+ object.
"""
if line == "..":
else:
print "Already at top level"
return False
+ elif len(line) == 0 or line == "/":
+ self.parents = self.parents[0:1]
+ self.path = []
+ return False
pointer = self.parents[-1]
dirs, entries = self._get_entries(pointer)
print
return True
+
class Error(Exception):
"""Generic exception"""
pass