From f9b632eebb90658a92b84420ef1b388d266c3151 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Thu, 6 Jul 2017 17:22:25 +0200 Subject: [PATCH] Improve listdir. --- cdist/core/util.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cdist/core/util.py b/cdist/core/util.py index a8216ef9..ca48c4c8 100644 --- a/cdist/core/util.py +++ b/cdist/core/util.py @@ -26,7 +26,10 @@ def listdir(path='.', include_dot=False): """os.listdir but do not include entries whose names begin with a dot('.') if include_dot is False. """ - return [x for x in os.listdir(path) if include_dot or not _ishidden(x)] + if include_dot: + return os.listdir(path) + else: + return [x for x in os.listdir(path) if not _ishidden(x)] def _ishidden(path):