1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-09 01:24:16 +00:00
This commit is contained in:
deadc0de6
2024-01-28 22:26:46 +01:00
committed by deadc0de
parent 9cf210e194
commit 0ac692b2f8
5 changed files with 254 additions and 9 deletions

View File

@@ -10,6 +10,7 @@ import os
# local imports
from dotdrop.utils import must_ignore
from dotdrop.logger import Logger
class FTreeDir:
@@ -22,6 +23,7 @@ class FTreeDir:
self.ignores = ignores
self.debug = debug
self.entries = []
self.log = Logger(debug=self.debug)
if os.path.exists(path) and os.path.isdir(path):
self._walk()
@@ -37,10 +39,12 @@ class FTreeDir:
if must_ignore([fpath], ignores=self.ignores,
debug=self.debug, strict=True):
continue
self.log.dbg(f'added file to list of {self.path}: {fpath}')
self.entries.append(fpath)
for dname in dirs:
dpath = os.path.join(root, dname)
if len(os.listdir(dpath)) < 1:
subs = os.listdir(dpath)
if len(subs) < 1:
# ignore empty directory
continue
# appending "/" allows to ensure pattern
@@ -50,6 +54,7 @@ class FTreeDir:
if must_ignore([dpath], ignores=self.ignores,
debug=self.debug, strict=True):
continue
self.log.dbg(f'added dir to list of {self.path}: {dpath}')
self.entries.append(dpath)
def compare(self, other):