Skip to content

Commit f1e01c4

Browse files
Fix for python < 3.12 on windows
1 parent 808e028 commit f1e01c4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

dissect/target/loaders/direct.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def get_files(path: Path) -> Iterator[Path]:
6060
def get_files(path: Path, max_depth: int = 7) -> Iterator[Path]:
6161
"""
6262
rglob seems to have issue on windows with python <3.12 when working on a case sensitive FS. Thus
63-
we use another implemntation without using rglob.
63+
we use another implementation without using rglob.
6464
Probably related to https://github.com/python/cpython/issues/94537
6565
6666
:param path:
@@ -71,14 +71,14 @@ def get_files(path: Path, max_depth: int = 7) -> Iterator[Path]:
7171
return
7272
if not path.exists():
7373
return
74-
if path.is_file():
74+
if path.is_dir():
75+
for f in path.iterdir():
76+
if f.is_dir():
77+
yield from get_files(f, max_depth=max_depth - 1)
78+
else:
79+
yield f
80+
elif path.is_file():
7581
yield path
76-
for f in path.iterdir():
77-
if f.is_dir():
78-
yield from get_files(f, max_depth=max_depth - 1)
79-
else:
80-
yield f
81-
8282
# Create a flat list of all file paths from all input directories
8383
all_paths = chain.from_iterable(get_files(p) for p in self.paths)
8484
# Filter out directories, keeping only files

0 commit comments

Comments
 (0)