| ... | @@ -177,9 +177,14 @@ test "os.path.networkShare" { | ... | @@ -177,9 +177,14 @@ test "os.path.networkShare" { |
| 177 | } | 177 | } |
| 178 | | 178 | |
| 179 | pub fn diskDesignator(path: []const u8) -> []const u8 { | 179 | pub fn diskDesignator(path: []const u8) -> []const u8 { |
| 180 | if (!is_windows) | 180 | if (is_windows) { |
| | 181 | return diskDesignatorWindows(path); |
| | 182 | } else { |
| 181 | return ""; | 183 | return ""; |
| | 184 | } |
| | 185 | } |
| 182 | | 186 | |
| | 187 | pub fn diskDesignatorWindows(path: []const u8) -> []const u8 { |
| 183 | return drive(path) ?? (networkShare(path) ?? []u8{}); | 188 | return drive(path) ?? (networkShare(path) ?? []u8{}); |
| 184 | } | 189 | } |
| 185 | | 190 | |
| ... | @@ -334,7 +339,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) -> %[]u8 | ... | @@ -334,7 +339,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) -> %[]u8 |
| 334 | mem.copy(u8, result, cwd); | 339 | mem.copy(u8, result, cwd); |
| 335 | result_index += cwd.len; | 340 | result_index += cwd.len; |
| 336 | | 341 | |
| 337 | root_slice = diskDesignator(result[0..result_index]); | 342 | root_slice = diskDesignatorWindows(result[0..result_index]); |
| 338 | } | 343 | } |
| 339 | %defer allocator.free(result); | 344 | %defer allocator.free(result); |
| 340 | | 345 | |
| ... | @@ -350,7 +355,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) -> %[]u8 | ... | @@ -350,7 +355,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) -> %[]u8 |
| 350 | continue; | 355 | continue; |
| 351 | } | 356 | } |
| 352 | } | 357 | } |
| 353 | var it = mem.split(p[diskDesignator(p).len..], "/\\"); | 358 | var it = mem.split(p[diskDesignatorWindows(p).len..], "/\\"); |
| 354 | while (it.next()) |component| { | 359 | while (it.next()) |component| { |
| 355 | if (mem.eql(u8, component, ".")) { | 360 | if (mem.eql(u8, component, ".")) { |
| 356 | continue; | 361 | continue; |
| ... | @@ -505,7 +510,7 @@ pub fn dirnameWindows(path: []const u8) -> []const u8 { | ... | @@ -505,7 +510,7 @@ pub fn dirnameWindows(path: []const u8) -> []const u8 { |
| 505 | if (path.len == 0) | 510 | if (path.len == 0) |
| 506 | return path[0..0]; | 511 | return path[0..0]; |
| 507 | | 512 | |
| 508 | const root_slice = diskDesignator(path); | 513 | const root_slice = diskDesignatorWindows(path); |
| 509 | if (path.len == root_slice.len) | 514 | if (path.len == root_slice.len) |
| 510 | return path; | 515 | return path; |
| 511 | | 516 | |