[kupfer] objects: Simplify DirectorySource get_items



commit 294b2b999f4aa3cc72d8d4f131856e6883420378
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Sat Sep 26 01:44:30 2009 +0200

    objects: Simplify DirectorySource get_items

 kupfer/objects.py |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/kupfer/objects.py b/kupfer/objects.py
index 7869240..e0af4ab 100644
--- a/kupfer/objects.py
+++ b/kupfer/objects.py
@@ -9,6 +9,7 @@ see the main program file, and COPYING for details.
 """
 
 import itertools
+import os
 from os import path
 
 import gobject
@@ -873,13 +874,10 @@ class DirectorySource (Source, PicklingHelperMixin, FilesystemWatchMixin):
 		self.monitor = self.monitor_directories(self.directory)
 
 	def get_items(self):
-		exclude = lambda f: f.startswith(".") if not self.show_hidden else None
-		dirlist = utils.get_dirlist(self.directory, exclude=exclude)
-		def file_leaves(files):
-			for file in files:
-				yield ConstructFileLeaf(file)
+		for fname in os.listdir(self.directory):
+			if self.show_hidden or not fname.startswith("."):
+				yield ConstructFileLeaf(path.join(self.directory, fname))
 
-		return file_leaves(dirlist)
 	def should_sort_lexically(self):
 		return True
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]