| ... | ... | @@ -413,7 +413,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath { |
| 413 | 413 | return relative_path; |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | | var it = mem.tokenizeScalar(u8, path, this_sep); |
| 416 | var it = mem.tokenizeAny(u8, path, "/\\"); |
| 417 | 417 | _ = (it.next() orelse return relative_path); |
| 418 | 418 | _ = (it.next() orelse return relative_path); |
| 419 | 419 | return WindowsPath{ |
| ... | ... | @@ -439,6 +439,12 @@ test windowsParsePath { |
| 439 | 439 | try testing.expect(parsed.kind == WindowsPath.Kind.NetworkShare); |
| 440 | 440 | try testing.expect(mem.eql(u8, parsed.disk_designator, "\\\\a\\b")); |
| 441 | 441 | } |
| 442 | { |
| 443 | const parsed = windowsParsePath("\\\\a/b"); |
| 444 | try testing.expect(parsed.is_abs); |
| 445 | try testing.expect(parsed.kind == WindowsPath.Kind.NetworkShare); |
| 446 | try testing.expect(mem.eql(u8, parsed.disk_designator, "\\\\a/b")); |
| 447 | } |
| 442 | 448 | { |
| 443 | 449 | const parsed = windowsParsePath("\\\\a\\"); |
| 444 | 450 | try testing.expect(!parsed.is_abs); |
| ... | ... | @@ -492,11 +498,8 @@ fn compareDiskDesignators(kind: WindowsPath.Kind, p1: []const u8, p2: []const u8 |
| 492 | 498 | return ascii.toUpper(p1[0]) == ascii.toUpper(p2[0]); |
| 493 | 499 | }, |
| 494 | 500 | WindowsPath.Kind.NetworkShare => { |
| 495 | | const sep1 = p1[0]; |
| 496 | | const sep2 = p2[0]; |
| 497 | | |
| 498 | | var it1 = mem.tokenizeScalar(u8, p1, sep1); |
| 499 | | var it2 = mem.tokenizeScalar(u8, p2, sep2); |
| 501 | var it1 = mem.tokenizeAny(u8, p1, "/\\"); |
| 502 | var it2 = mem.tokenizeAny(u8, p2, "/\\"); |
| 500 | 503 | |
| 501 | 504 | return windows.eqlIgnoreCaseWtf8(it1.next().?, it2.next().?) and windows.eqlIgnoreCaseWtf8(it1.next().?, it2.next().?); |
| 502 | 505 | }, |
| ... | ... | @@ -795,6 +798,7 @@ test resolveWindows { |
| 795 | 798 | try testResolveWindows(&[_][]const u8{ "c:/ignore", "c:/some/file" }, "C:\\some\\file"); |
| 796 | 799 | try testResolveWindows(&[_][]const u8{ "d:/ignore", "d:some/dir//" }, "D:\\ignore\\some\\dir"); |
| 797 | 800 | try testResolveWindows(&[_][]const u8{ "//server/share", "..", "relative\\" }, "\\\\server\\share\\relative"); |
| 801 | try testResolveWindows(&[_][]const u8{ "\\\\server/share", "..", "relative\\" }, "\\\\server\\share\\relative"); |
| 798 | 802 | try testResolveWindows(&[_][]const u8{ "c:/", "//" }, "C:\\"); |
| 799 | 803 | try testResolveWindows(&[_][]const u8{ "c:/", "//dir" }, "C:\\dir"); |
| 800 | 804 | try testResolveWindows(&[_][]const u8{ "c:/", "//server/share" }, "\\\\server\\share\\"); |