Commit 61eb97ee by willmcgugan

Some tweaks

parent 6a888fbc
...@@ -181,8 +181,10 @@ class MemoryFS(FS): ...@@ -181,8 +181,10 @@ class MemoryFS(FS):
if self.isdir(path): if self.isdir(path):
return "Memory dir" return "Memory dir"
else: elif self.isfile(path):
return "Memory file object" return "Memory file object"
else:
return "No description available"
def isdir(self, path): def isdir(self, path):
......
...@@ -57,6 +57,16 @@ class MountFS(FS): ...@@ -57,6 +57,16 @@ class MountFS(FS):
return self, path return self, path
def desc(self, path):
fs, delegate_path = self._delegate(path)
if fs is self:
return "Mount dir"
return "Mounted dir, maps to path %s on %s" % (delegate_path, str(fs))
def isdir(self, path): def isdir(self, path):
fs, delegate_path = self._delegate(path) fs, delegate_path = self._delegate(path)
...@@ -86,7 +96,8 @@ class MountFS(FS): ...@@ -86,7 +96,8 @@ class MountFS(FS):
self.mem_fs.mkdir(path, recursive=True) self.mem_fs.mkdir(path, recursive=True)
mount_filename = pathjoin(path, '.mount') mount_filename = pathjoin(path, '.mount')
mount = self.mem_fs.open(mount_filename, 'w') mount = self.mem_fs.open(mount_filename, 'w')
mount.fs = fs mount.name = name
mount.fs = fs
self.mounts[name] = (path, fs) self.mounts[name] = (path, fs)
...@@ -104,6 +115,7 @@ if __name__ == "__main__": ...@@ -104,6 +115,7 @@ if __name__ == "__main__":
#print mountfs.listdir('1/2/Memroot/B/C') #print mountfs.listdir('1/2/Memroot/B/C')
print mountfs.desc('1/2/Memroot/B')
print_fs(mountfs) print_fs(mountfs)
#print mountfs._delegate('1/2/Memroot/B') #print mountfs._delegate('1/2/Memroot/B')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment