diff --git a/voussoirkit/pathclass.py b/voussoirkit/pathclass.py index 6cf285f..f793d10 100644 --- a/voussoirkit/pathclass.py +++ b/voussoirkit/pathclass.py @@ -11,6 +11,9 @@ class PathclassException(Exception): class Exists(PathclassException): pass +class IsLink(PathclassException): + pass + class NotExists(PathclassException): pass @@ -20,6 +23,9 @@ class NotDirectory(PathclassException): class NotFile(PathclassException): pass +class NotLink(PathclassException): + pass + class Extension: def __init__(self, ext): @@ -119,6 +125,10 @@ class Path: if self.exists: raise Exists(self) + def assert_not_link(self): + if self.is_link: + raise IsLink(self) + def assert_is_file(self): if not self.is_file: raise NotFile(self) @@ -127,6 +137,10 @@ class Path: if not self.is_dir: raise NotDirectory(self) + def assert_is_link(self): + if not self.is_link: + raise NotLink(self) + def add_extension(self, extension): extension = Extension(extension) if extension == '':