Skip to main content

I want to be able to pass strings to this

ID
376bfac
date
2025-03-05 21:47:29+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
ada274c
message
I want to be able to pass strings to this
changed files
1 file, 3 additions, 1 deletion

Changed files

expansions/get_file_paths.py (662) → expansions/get_file_paths.py (695)

diff --git a/expansions/get_file_paths.py b/expansions/get_file_paths.py
index 0773e40..4efd3fa 100644
--- a/expansions/get_file_paths.py
+++ b/expansions/get_file_paths.py
@@ -2,10 +2,12 @@ from collections.abc import Iterator
 from pathlib import Path
 
 
-def get_file_paths_under(root: Path = Path("."), *, suffix: str = "") -> Iterator[Path]:
+def get_file_paths_under(root: Path | str = Path("."), *, suffix: str = "") -> Iterator[Path]:
     """
     Generates the absolute paths to every matching file under ``root``.
     """
+    root = Path(root)
+    
     if root.exists() and not root.is_dir():
         raise ValueError(f"Cannot find files under non-directory: {root!r}")