Use os.path.commonprefix to get common path.

os.path.commonpath is only available on Python 3.5.
This commit is contained in:
Florian Bruhin 2015-11-11 21:11:14 +01:00
parent 3680f01576
commit e25ae49c0e

View File

@ -175,7 +175,7 @@ def check(fileobj, perfect_files):
basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..',
'..'))
if os.path.isabs(filename):
common_path = os.path.commonpath([basedir, filename])
common_path = os.path.commonprefix([basedir, filename])
if common_path:
filename = filename[len(common_path):].lstrip('/')