File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1717from string import Formatter
1818
1919from ..logger import create_logger
20+ from ..platformflags import is_windows
2021
2122logger = create_logger ()
2223
@@ -439,8 +440,9 @@ class Location:
439440 (?P<path>.+)
440441 """
441442
442- # abs_path must start with a slash.
443- abs_path_re = r"(?P<path>/.+)"
443+ abs_path_re_posix = r"(?P<path>/.+)" # abs path must start with a slash.
444+ abs_path_re_win = r"(?P<path>[a-zA-Z]:/.+)" # abs path must start with drive : slash.
445+ abs_path_re = abs_path_re_win if is_windows else abs_path_re_posix
444446
445447 # path may or may not start with a slash.
446448 abs_or_rel_path_re = r"(?P<path>.+)"
@@ -458,7 +460,8 @@ class Location:
458460
459461 rclone_re = re .compile (r"(?P<proto>rclone):(?P<path>(.*))" , re .VERBOSE )
460462
461- file_or_socket_re = re .compile (r"(?P<proto>(file|socket))://" + abs_path_re , re .VERBOSE )
463+ sep = r"/" if is_windows else r"" # on windows, an addtl. slash is needed
464+ file_or_socket_re = re .compile (r"(?P<proto>(file|socket))://" + sep + abs_path_re , re .VERBOSE )
462465
463466 local_re = re .compile (local_path_re , re .VERBOSE )
464467
Original file line number Diff line number Diff line change 88
99is_win32 = sys .platform .startswith ("win32" )
1010is_cygwin = sys .platform .startswith ("cygwin" )
11+ is_msys = sys .platform .startswith ("msys" )
12+ is_windows = is_win32 or is_cygwin or is_msys
1113
1214is_linux = sys .platform .startswith ("linux" )
1315is_freebsd = sys .platform .startswith ("freebsd" )
You can’t perform that action at this time.
0 commit comments