@@ -86,6 +86,10 @@ def __init__(self, frame_file_path: str) -> None:
86
86
# Remove drive letter if it exists
87
87
if is_windows_path and frame_file_path [1 ] == ":" :
88
88
frame_file_path = frame_file_path [2 :]
89
+ # windows drive letters can be like C:\ or C:
90
+ # so we need to remove the slash if it exists
91
+ if frame_file_path [0 ] == "/" :
92
+ frame_file_path = frame_file_path [1 :]
89
93
90
94
start_at_index = get_straight_path_prefix_end_index (frame_file_path )
91
95
self .straight_path_prefix = frame_file_path [:start_at_index ]
@@ -157,7 +161,7 @@ def list_file_matches(self, frame_filename: FrameFilename) -> list[dict[str, str
157
161
)
158
162
continue
159
163
160
- if stack_path .replace (stack_root , source_root , 1 ) != source_path :
164
+ if stack_path .replace (stack_root , source_root , 1 ). replace ( " \\ " , "/" ) != source_path :
161
165
logger .info (
162
166
"Unexpected stack_path/source_path found. A code mapping was not generated." ,
163
167
extra = {
@@ -271,7 +275,7 @@ def _generate_code_mapping_from_tree(
271
275
)
272
276
return []
273
277
274
- if stack_path .replace (stack_root , source_root , 1 ) != source_path :
278
+ if stack_path .replace (stack_root , source_root , 1 ). replace ( " \\ " , "/" ) != source_path :
275
279
logger .info (
276
280
"Unexpected stack_path/source_path found. A code mapping was not generated." ,
277
281
extra = {
@@ -521,8 +525,8 @@ def find_roots(stack_path: str, source_path: str) -> tuple[str, str]:
521
525
If there is no overlap, raise an exception since this should not happen
522
526
"""
523
527
stack_root = ""
524
- if stack_path [0 ] == "/" :
525
- stack_root += "/"
528
+ if stack_path [0 ] == "/" or stack_path [ 0 ] == " \\ " :
529
+ stack_root += stack_path [ 0 ]
526
530
stack_path = stack_path [1 :]
527
531
528
532
if stack_path == source_path :
@@ -550,7 +554,7 @@ def find_roots(stack_path: str, source_path: str) -> tuple[str, str]:
550
554
source_root = source_path .rpartition (overlap )[0 ]
551
555
stack_root += stack_path_delim .join (stack_root_items )
552
556
553
- if stack_root and stack_root [- 1 ] != SLASH : # append trailing slash
557
+ if stack_root and stack_root [- 1 ] != stack_path_delim : # append trailing slash
554
558
stack_root = f"{ stack_root } { stack_path_delim } "
555
559
if source_root and source_root [- 1 ] != SLASH :
556
560
source_root = f"{ source_root } { SLASH } "
0 commit comments