summaryrefslogtreecommitdiffstats
path: root/src/utils/fs.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/fs.py')
-rw-r--r--src/utils/fs.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/fs.py b/src/utils/fs.py
index 43011ef..7500ebd 100644
--- a/src/utils/fs.py
+++ b/src/utils/fs.py
@@ -14,6 +14,16 @@ from subprocess import DEVNULL
import psutil
+def find_mountpoint(path):
+ """
+ Returns mountpoint of a given path
+ """
+ path = os.path.abspath(path)
+ while not os.path.ismount(path):
+ path = os.path.dirname(path)
+ return path
+
+
def mount_mkdir(source, target):
"""
Mounts and creates the mountpoint directory if it's not present.