Skip to content

Commit c63a92e

Browse files
committed
Further windows path refinements
1 parent 37df4b6 commit c63a92e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

util.bzl

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,18 @@ def windows_path(path):
1414
for letter in _DRIVE_LETTERS:
1515
prefix = "/%s/" % letter
1616
if path.startswith(prefix):
17-
return path.replace(
17+
return "%s:\\" % letter.upper() + path.removeprefix(
1818
prefix,
19-
"%s:\\" % letter.upper(),
2019
).replace("/", "\\")
2120
return path.replace("/", "\\")
2221

2322
def msys2_path(path):
2423
for letter in _DRIVE_LETTERS:
25-
prefix = "%s:\\" % letter.upper()
26-
if path.startswith(prefix):
27-
return path.replace(
28-
prefix,
29-
"/%s/" % letter,
30-
).replace("\\", "/")
24+
for prefix in ["%s:" % letter.upper(), "%s:" % letter]:
25+
if path.startswith(prefix):
26+
return "/%s" % letter + path.removeprefix(
27+
prefix,
28+
).replace("\\", "/")
3129
return path.replace("\\", "/")
3230

3331
def without(item, elements):

0 commit comments

Comments
 (0)