diff --git a/melamine/validators.py b/melamine/validators.py index c300069..226d24d 100644 --- a/melamine/validators.py +++ b/melamine/validators.py @@ -1,20 +1,22 @@ import os import platform import sys -from pathlib import Path +from pathlib import Path as PathSync + +from aiopath import Path def validate_file_folder(value: str) -> Path: - file_folder_path = Path(value) + file_folder_path = PathSync(value) if not file_folder_path.exists(): raise FileNotFoundError(f"No such file or folder: {value}") if not file_folder_path.is_file() and not file_folder_path.is_dir(): raise TypeError(f"Not a file or directory: {value}") - return file_folder_path + return Path(value) def validate_logfile(value: str) -> Path: - logfile_path = Path(value) + logfile_path = PathSync(value) if logfile_path.exists(): confirm = input(f"The file {value} already exists. Do you want to overwrite it? ([y]es/[n]o): ") if confirm.lower() not in ["yes", "y"]: