summary refs log tree commit diff stats
path: root/code/directory.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-11-24 02:02:04 +0100
committerhut <hut@lavabit.com>2009-11-24 02:02:04 +0100
commit798d06a2317a5bb4ee38cec4d1d4f5d428d75593 (patch)
tree335fa4def2632c91acd11e4cee9aac32f9ddd15b /code/directory.py
parent556d84cd0fa94372c3fc2eb722f6925e61c42778 (diff)
downloadranger-798d06a2317a5bb4ee38cec4d1d4f5d428d75593.tar.gz
stuff
Diffstat (limited to 'code/directory.py')
-rw-r--r--code/directory.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/code/directory.py b/code/directory.py
index ef68d35f..da7c0948 100644
--- a/code/directory.py
+++ b/code/directory.py
@@ -1,5 +1,5 @@
 import fsobject
-import file
+import file, debug
 
 class Directory(fsobject.FSObject):
 	def __init__(self, path):
@@ -19,10 +19,17 @@ class Directory(fsobject.FSObject):
 		self.content_loaded = True
 		import os
 		if self.exists:
-			self.filenames = os.listdir(self.path)
+			basenames = os.listdir(self.path)
+			mapped = map(lambda name: os.path.join(self.path, name), basenames)
+			self.filenames = list(mapped)
+			self.infostring = ' %d' % len(self.filenames)
+			debug.log('infostring set!')
 			self.files = []
 			for name in self.filenames:
-				f = file.File(name)
+				if os.path.isdir(name):
+					f = Directory(name)
+				else:
+					f = file.File(name)
 				f.load()
 				self.files.append(f)
 	
@@ -36,7 +43,7 @@ class Directory(fsobject.FSObject):
 	
 	def __getitem__(self, key):
 		if not self.accessible: raise fsobject.NotLoadedYet()
-		return self.filenames[key]
+		return self.files[key]
 
 if __name__ == '__main__':
 	d = Directory('.')