about summary refs log blame commit diff stats
path: root/ranger/ext/mount_path.py
blob: 62092dda9f57b81d804709efd59ee4dec02f42a4 (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                                 
 
                                                                  
 

                                                       
 
                     






                                           
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.

from __future__ import (absolute_import, division, print_function)

from os.path import realpath, abspath, dirname, ismount


def mount_path(path):
    """Get the mount root of a directory"""
    path = abspath(realpath(path))
    while path != '/':
        if ismount(path):
            return path
        path = dirname(path)
    return '/'