Skip to content

Commit a9febcd

Browse files
author
Sascha Goldhofer
committed
Change filecache to exclude folder based on relative path
1 parent 3e8eab9 commit a9febcd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

project/FileCacheWorker.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,15 @@ def read(self, folder, base=None):
4343
folder_cache = {}
4444
base = base if base is not None else folder
4545

46-
# test ignore expressions on current path
47-
for test in self.exclude_folders:
48-
if re.search(test, folder) is not None:
49-
verbose(ID, "skip " + folder)
50-
return folder_cache
46+
if base is not folder:
47+
# ensure project_folders are not excluded by another folders exclude patterns
48+
# e.g. project/node_modules excludes project/node_modules/module, which is also a project folder
49+
relative_folder = os.path.relpath(folder, base)
50+
# test ignore expressions on current path
51+
for test in self.exclude_folders:
52+
if re.search(test, relative_folder) is not None:
53+
# verbose(ID, "skip " + folder)
54+
return folder_cache
5155

5256
# ressources =
5357
for ressource in os.listdir(folder):

0 commit comments

Comments
 (0)