Skip to content

Commit

Permalink
udpate to be inclusive of file checking
Browse files Browse the repository at this point in the history
  • Loading branch information
RHammond2 committed Dec 1, 2023
1 parent 232f498 commit 8c2cf22
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions floris/type_dec.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def iter_validator(iter_type, item_types: Union[Any, Tuple[Any]]) -> Callable:
return validator

def convert_to_path(fn: str | Path) -> Path:
"""Converts an input string or pathlib.Path object to a fully resolved ``pathlib.Path``
"""Converts an input string or ``pathlib.Path`` object to a fully resolved ``pathlib.Path``
object.
Args:
Expand Down Expand Up @@ -113,11 +113,11 @@ def convert_to_path(fn: str | Path) -> Path:
absolute_fn = fn.resolve()
relative_fn_script = (base_fn_script / fn).resolve()
relative_fn_sys = (base_fn_sys / fn).resolve()
if absolute_fn.is_dir():
if absolute_fn.exists():
return absolute_fn
if relative_fn_script.is_dir():
if relative_fn_script.exists():
return relative_fn_script
if relative_fn_sys.is_dir():
if relative_fn_sys.exists():
return relative_fn_sys
raise FileExistsError(
f"{fn} could not be found as either a\n"
Expand Down

0 comments on commit 8c2cf22

Please sign in to comment.