diff options
author | crupest <crupest@outlook.com> | 2024-11-11 01:12:29 +0800 |
---|---|---|
committer | Yuqian Yang <crupest@crupest.life> | 2025-01-20 23:41:34 +0800 |
commit | 672492caff469ea135d5e1338d4406d2b20bab16 (patch) | |
tree | 4ae61ce81e170c5208123d1b0a63bba20c6119f1 /tools/cru-py/cru/_path.py | |
parent | 90a72d2d7ed4a5eadfe36f62d81f26ca3324e49b (diff) | |
download | crupest-672492caff469ea135d5e1338d4406d2b20bab16.tar.gz crupest-672492caff469ea135d5e1338d4406d2b20bab16.tar.bz2 crupest-672492caff469ea135d5e1338d4406d2b20bab16.zip |
HALF WORK: 2024.1.20 - 5
Diffstat (limited to 'tools/cru-py/cru/_path.py')
-rw-r--r-- | tools/cru-py/cru/_path.py | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/tools/cru-py/cru/_path.py b/tools/cru-py/cru/_path.py deleted file mode 100644 index a131c41..0000000 --- a/tools/cru-py/cru/_path.py +++ /dev/null @@ -1,23 +0,0 @@ -from pathlib import Path - -from ._error import CruException - - -class CruPathError(CruException): - def __init__(self, message, _path: Path, *args, **kwargs): - super().__init__(message, *args, **kwargs) - self._path = _path - - @property - def path(self) -> Path: - return self._path - - -class CruPath(Path): - def check_parents_dir(self, must_exist: bool = False) -> bool: - for p in reversed(self.parents): - if not p.exists() and not must_exist: - return False - if not p.is_dir(): - raise CruPathError("Parents path must be a dir.", self) - return True |