Skip to content

Commit 096e583

Browse files
committed
fix: only match dirs when globs if a tail is given
1 parent 8535338 commit 096e583

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/caelestia/utils/dots/manifest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ def expanded_dests(self) -> list[Path]:
5757
glob_idx = max(i for i, part in enumerate(parts) if _GLOB_MAGIC.search(part))
5858
pattern = str(Path(*parts[: glob_idx + 1]))
5959
tail = parts[glob_idx + 1 :]
60-
return [Path(match, *tail) for match in sorted(glob.glob(pattern))]
60+
matches = sorted(glob.glob(pattern))
61+
if tail: # Only match dirs if a tail exists
62+
matches = [match for match in matches if Path(match).is_dir()]
63+
return [Path(match, *tail) for match in matches]
6164

6265

6366
@dataclass(frozen=True)

0 commit comments

Comments
 (0)