From ca11b8462b558f914ca82bca36b389b42724f5ab Mon Sep 17 00:00:00 2001 From: Ben Hourahine Date: Sun, 31 Aug 2025 11:53:19 +0100 Subject: [PATCH] Move path to correctly parse cleanup Regex was previously unable to test path of each of the files during clean-up phase. --- hooks/post_gen_project.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 55bcadc..ebf5e9c 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -48,10 +48,10 @@ def _remove_superfluous_paths(): """Removes superfluous files and directories.""" optional_paths = [(re.compile(path), keep) for path, keep in OPTIONAL_PATHS] rootdir = "." - for dirpath, dirnames, filenames in os.walk(rootdir): - for pathname in dirnames + filenames: - fullpath = os.path.join(dirpath, pathname) - for pattern, keep in optional_paths: + for pattern, keep in optional_paths: + for dirpath, dirnames, filenames in os.walk(rootdir): + for pathname in dirnames + filenames: + fullpath = os.path.join(dirpath, pathname) if pattern.match(fullpath): if not keep: if os.path.isfile(fullpath):