[elbe-devel] [PATCH v2 2/8] Add 'realpath' method to 'Filesystem'
dion at linutronix.de
dion at linutronix.de
Tue May 28 12:06:00 CEST 2019
From: Olivier Dion <dion at linutronix.de>
Signed-off-by: Olivier Dion <dion at linutronix.de>
---
elbepack/filesystem.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/elbepack/filesystem.py b/elbepack/filesystem.py
index e1c08c5c..56cc05ab 100644
--- a/elbepack/filesystem.py
+++ b/elbepack/filesystem.py
@@ -84,6 +84,13 @@ class Filesystem(object):
def mkdir(self, path):
os.makedirs(self.fname(path))
+ def realpath(self, path):
+ while self.islink(path):
+ path = os.path.realpath(self.fname(path))
+ if path.startswith(self.path):
+ return path
+ return self.fname(path)
+
def symlink(self, src, path, allow_exists=False):
try:
os.symlink(src, self.fname(path))
--
2.11.0
More information about the elbe-devel
mailing list