Add childMounts function for detect mount points.

develop
Mike Hiretsky 14 years ago
parent e51a767d92
commit 2403fcbc78

@ -617,6 +617,22 @@ def isMount(path):
map(lambda x: [x[0], x[1]], map(lambda x: x.split(" "),
open(mtabFile)))),[""]))[0]
def childMounts(path):
"""Get all mount points which contain path"""
if path != "none":
absPath = os.path.abspath(path)
else:
absPath = path
mtabFile = '/etc/mtab'
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],
map(lambda x: [x[0], x[1]],
map(lambda x: x.split(" "),
open(mtabFile)))),
[])
def pathJoin(*paths):
"""Складывает пути, в отличии от os.path.join, складывает абсолютные пути"""
if len(paths)==1:

Loading…
Cancel
Save