Skip to content

Commit

Permalink
correct impl for root parts and drive 'letters' of varying lenght
Browse files Browse the repository at this point in the history
  • Loading branch information
tgbugs committed Nov 6, 2019
1 parent a2f2bba commit 53dc0ba
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions augpathlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,12 +723,16 @@ def splitroot(self, part, sep='\\'):
drv = part[:2]
part = part[2:]
first = third
elif (part[-1:] == sep and
part[-2:-1] == ':' and
part[:-2] in self.drive_letters):
drv = part[:-2]
part = part[-2:]
first = part[-1:]
else:
index1 = part.find(':')
index2 = part.find(sep)
if index1 != -1 and (index2 == -1 or index1 < index2):
maybe_drv = part[:index1]
if maybe_drv in self.drive_letters:
drv = part[:index1]
part = part[index1:]
first = part[0:1]

if first == sep:
root = first
part = part.lstrip(sep)
Expand Down

0 comments on commit 53dc0ba

Please sign in to comment.