Fix childMounts function.

develop
Mike Hiretsky 14 years ago
parent 7238715500
commit 40dbe591b1

@ -617,6 +617,13 @@ def isMount(path):
map(lambda x: [x[0], x[1]], map(lambda x: x.split(" "),
open(mtabFile)))),[""]))[0]
def commonPath(*paths):
"""Return common path from list of paths"""
paths = map(lambda x:os.path.abspath(x).split('/'),paths)
res = map(lambda x:x[0],
filter(lambda x:filter(lambda y:x[0]==y,x[1:]),zip(*paths)))
return "/".join(res)
def childMounts(path):
"""Get all mount points which contain path"""
if path != "none":
@ -627,7 +634,8 @@ def childMounts(path):
if not os.access(mtabFile,os.R_OK):
return ""
return reduce(lambda x,y: x + [y],
filter(lambda x: absPath in x[0] or absPath in x[1],
filter(lambda x: commonPath(absPath,x[0])==absPath or \
commonPath(absPath,x[1])==absPath,
map(lambda x: [x[0], x[1]],
map(lambda x: x.split(" "),
open(mtabFile)))),

Loading…
Cancel
Save