We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a9d0d59 commit d2d2099Copy full SHA for d2d2099
src/tinyscript/VERSION.txt
@@ -1 +1 @@
1
-1.30.17
+1.30.18
src/tinyscript/helpers/path.py
@@ -235,9 +235,14 @@ def is_samepath(self, otherpath):
235
""" Check if both paths have the same parts. """
236
return self.absolute().parts == Path(otherpath).absolute().parts
237
238
- def is_under(self, parentpath):
+ def is_under(self, parentpath, error=False):
239
""" Check if the path is under a parent path. """
240
p = Path(parentpath).absolute()
241
+ if not p.exists():
242
+ if error:
243
+ raise OSError("Path to be compared does not exist")
244
+ else:
245
+ return False
246
if not p.is_dir():
247
p = Path(p.dirname)
248
return p in self.absolute().parents
0 commit comments