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