Show More
@@ -618,7 +618,9 def fspath(name, root): | |||||
618 | called, for case-sensitive filesystems (simply because it's expensive). |
|
618 | called, for case-sensitive filesystems (simply because it's expensive). | |
619 | ''' |
|
619 | ''' | |
620 | # If name is absolute, make it relative |
|
620 | # If name is absolute, make it relative | |
621 | if name.lower().startswith(root.lower()): |
|
621 | name = normcase(name) | |
|
622 | root = normcase(root) | |||
|
623 | if name.startswith(root): | |||
622 | l = len(root) |
|
624 | l = len(root) | |
623 | if name[l] == os.sep or name[l] == os.altsep: |
|
625 | if name[l] == os.sep or name[l] == os.altsep: | |
624 | l = l + 1 |
|
626 | l = l + 1 | |
@@ -633,7 +635,7 def fspath(name, root): | |||||
633 | # Protect backslashes. This gets silly very quickly. |
|
635 | # Protect backslashes. This gets silly very quickly. | |
634 | seps.replace('\\','\\\\') |
|
636 | seps.replace('\\','\\\\') | |
635 | pattern = re.compile(r'([^%s]+)|([%s]+)' % (seps, seps)) |
|
637 | pattern = re.compile(r'([^%s]+)|([%s]+)' % (seps, seps)) | |
636 |
dir = os.path. |
|
638 | dir = os.path.normpath(root) | |
637 | result = [] |
|
639 | result = [] | |
638 | for part, sep in pattern.findall(name): |
|
640 | for part, sep in pattern.findall(name): | |
639 | if sep: |
|
641 | if sep: | |
@@ -644,16 +646,15 def fspath(name, root): | |||||
644 | _fspathcache[dir] = os.listdir(dir) |
|
646 | _fspathcache[dir] = os.listdir(dir) | |
645 | contents = _fspathcache[dir] |
|
647 | contents = _fspathcache[dir] | |
646 |
|
648 | |||
647 | lpart = part.lower() |
|
|||
648 | lenp = len(part) |
|
649 | lenp = len(part) | |
649 | for n in contents: |
|
650 | for n in contents: | |
650 |
if lenp == len(n) and n |
|
651 | if lenp == len(n) and normcase(n) == part: | |
651 | result.append(n) |
|
652 | result.append(n) | |
652 | break |
|
653 | break | |
653 | else: |
|
654 | else: | |
654 | # Cannot happen, as the file exists! |
|
655 | # Cannot happen, as the file exists! | |
655 | result.append(part) |
|
656 | result.append(part) | |
656 |
dir = os.path.join(dir, |
|
657 | dir = os.path.join(dir, part) | |
657 |
|
658 | |||
658 | return ''.join(result) |
|
659 | return ''.join(result) | |
659 |
|
660 |
General Comments 0
You need to be logged in to leave comments.
Login now