aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bachelier <laurent@bachelier.name>2016-08-13 01:04:30 +0200
committerLaurent Bachelier <laurent@bachelier.name>2016-08-13 01:05:54 +0200
commit2cea67098f658322cfd03073a3df1686599ec2b6 (patch)
treef13abed36bbf9b478e502fda1933f446b61a5355
parentFix excluding directories in file list (diff)
downloadbrutha-2cea67098f658322cfd03073a3df1686599ec2b6.tar.xz
Avoid listing directories with no files twice
-rw-r--r--brutha/directory.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/brutha/directory.py b/brutha/directory.py
index f1ec746..ab3170c 100644
--- a/brutha/directory.py
+++ b/brutha/directory.py
@@ -23,8 +23,10 @@ class Directory(object):
self.options = {}
if options:
self.options.update(options)
- self._files = _files or \
- [f for f in os.listdir(self.path) if not os.path.isdir(os.path.join(self.path, f))]
+ if _files is None:
+ self._files = [f for f in os.listdir(self.path) if not os.path.isdir(os.path.join(self.path, f))]
+ else:
+ self._files = _files
def commands(self):
commands = []