diff --git a/src/AuDaGe/file_utilities.py b/src/AuDaGe/file_utilities.py index a1ad147..5ebfddf 100644 --- a/src/AuDaGe/file_utilities.py +++ b/src/AuDaGe/file_utilities.py @@ -1,3 +1,5 @@ +from collections.abc import Collection +from itertools import chain from os import PathLike, getcwd from pathlib import Path @@ -9,11 +11,13 @@ def breadcrumb_to_path(breadcrumb: str, extension: str = "") -> Path: def find_file( - filepath: PathLike | Path | str, folders: list[Path] | None = None + filepath: PathLike | Path | str, folders: Collection[Path] = () ) -> Path: path = Path(filepath) - allfolders = ( - ([] if folders is None else folders) + [Path(getcwd())] + AuDaGe.folders + allfolders = chain( + [] if folders is None else folders, + [Path(getcwd())], + AuDaGe.folders, ) for folder in allfolders: fullpath = Path(folder, path).resolve()