From 8404ade16a57951ee6711239b7a9c70e5ff0b3f7 Mon Sep 17 00:00:00 2001 From: laggingreflex Date: Fri, 1 Jul 2016 21:06:29 +0530 Subject: [PATCH] Inherit file/folder_exclude_patterns from global settings Uses `folder_exclude_patterns` and `file_exclude_patterns` patterns to match against directories and files respectively, and not include them in the index. fixes #82 --- common.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/common.py b/common.py index 67b419c..985debc 100644 --- a/common.py +++ b/common.py @@ -390,11 +390,13 @@ def prepare_filelist(self, names, path, goto, indent): for name in names: full_name = join(path, goto, name) if isdir(full_name): - index_dirs.append(u'%s%s' % (full_name, os.sep)) - items.append(''.join([level, u"▸ ", name, os.sep])) + if not any(fnmatch.fnmatch(name, exclude_pattern) for exclude_pattern in self.view.settings().get('folder_exclude_patterns')): + index_dirs.append(u'%s%s' % (full_name, os.sep)) + items.append(''.join([level, u"▸ ", name, os.sep])) else: - index_files.append(full_name) - files.append(''.join([level, u"≡ ", name])) + if not any(fnmatch.fnmatch(name, exclude_pattern) for exclude_pattern in self.view.settings().get('file_exclude_patterns')): + index_files.append(full_name) + files.append(''.join([level, u"≡ ", name])) index = index_dirs + index_files self.index = self.index[:self.number_line] + index + self.index[self.number_line:] items += files