summary refs log tree commit diff stats
path: root/code/directory.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-11-23 12:00:05 +0100
committerhut <hut@lavabit.com>2009-11-23 12:00:05 +0100
commitb0f0027f94a9619652392f1df9ad6c7346f46c0f (patch)
treedf693321e687c117cad96ade9f6f037900fa81ed /code/directory.py
parent2b3db775535290cbbaae570dc79ed3438afe4795 (diff)
downloadranger-b0f0027f94a9619652392f1df9ad6c7346f46c0f.tar.gz
a bunch of half assed implementations
Diffstat (limited to 'code/directory.py')
-rw-r--r--code/directory.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/code/directory.py b/code/directory.py
new file mode 100644
index 00000000..4cb9fd72
--- /dev/null
+++ b/code/directory.py
@@ -0,0 +1,33 @@
+
+class Directory():
+	def __init__(self, path):
+		self.path = path
+		self.files_loaded = False
+		self.scheduled = False
+		self.files = None
+		self.mtime = None
+		self.exists = True
+
+	def load_files(self):
+		import os
+		try:
+			self.files = os.listdir(self.path)
+			self.exists = True
+		except OSError:
+			self.files = []
+			self.exists = False
+		self.files_loaded = True
+
+	def __len__(self):
+		return len(self.files)
+	
+	def __getitem__(self, key):
+		return self.files[key]
+
+if __name__ == '__main__':
+	d = Directory('.')
+	d.load_files()
+	print(d.files)
+	print(d[1])
+
+