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 | 8f4ce33d5d55401102d6ebb6d4d0d8b9136ee1ca (patch) | |
tree | 4ae61ce81e170c5208123d1b0a63bba20c6119f1 /tools/cru-py/cru/_path.py | |
parent | a293e50247ff6e61cd730b6ef02c287d9264f17b (diff) | |
download | crupest-8f4ce33d5d55401102d6ebb6d4d0d8b9136ee1ca.tar.gz crupest-8f4ce33d5d55401102d6ebb6d4d0d8b9136ee1ca.tar.bz2 crupest-8f4ce33d5d55401102d6ebb6d4d0d8b9136ee1ca.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 |