From f0f558d827ed0816e7bb8e3878741c224f962d0f Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Sun, 28 Jan 2024 16:59:16 +0100 Subject: [PATCH] follow symlink --- dotdrop/ftree.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dotdrop/ftree.py b/dotdrop/ftree.py index 9aefc8d..d4cc1b7 100644 --- a/dotdrop/ftree.py +++ b/dotdrop/ftree.py @@ -31,7 +31,7 @@ class FTreeDir: ignore empty directory test for ignore pattern """ - for root, dirs, files in os.walk(self.path): + for root, dirs, files in os.walk(self.path, followlinks=True): for file in files: fpath = os.path.join(root, file) if must_ignore([fpath], ignores=self.ignores, @@ -43,6 +43,10 @@ class FTreeDir: if len(os.listdir(dpath)) < 1: # ignore empty directory continue + # appending "/" allows to ensure pattern + # like "*/dir/*" will match the content of the directory + # but also the directory itself + dpath += os.path.sep if must_ignore([dpath], ignores=self.ignores, debug=self.debug, strict=True): continue