summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linuxnamespaces/atlocation.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/linuxnamespaces/atlocation.py b/linuxnamespaces/atlocation.py
index eecfed1..2bd3f51 100644
--- a/linuxnamespaces/atlocation.py
+++ b/linuxnamespaces/atlocation.py
@@ -217,6 +217,13 @@ class AtLocation:
follow_symlinks=follow_symlinks,
)
+ def is_absolute(self) -> bool:
+ """Report whether the location is absolute or not. Not that any
+ location with an a valid filedescriptor is considered absolute as it is
+ not dependent on the working directory.
+ """
+ return self.fd >= 0 or pathlib.Path(self.location).is_absolute()
+
def link(self, dst: "AtLocationLike") -> None:
"""Wrapper for os.link supplying src_dir_fd, dst_dir_fd and
follow_symlinks.