Use os.path.commonprefix to get common path.
os.path.commonpath is only available on Python 3.5.
This commit is contained in:
parent
3680f01576
commit
e25ae49c0e
@ -175,7 +175,7 @@ def check(fileobj, perfect_files):
|
|||||||
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..',
|
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..',
|
||||||
'..'))
|
'..'))
|
||||||
if os.path.isabs(filename):
|
if os.path.isabs(filename):
|
||||||
common_path = os.path.commonpath([basedir, filename])
|
common_path = os.path.commonprefix([basedir, filename])
|
||||||
if common_path:
|
if common_path:
|
||||||
filename = filename[len(common_path):].lstrip('/')
|
filename = filename[len(common_path):].lstrip('/')
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user