| ... | ... | @@ -177,9 +177,14 @@ test "os.path.networkShare" { |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | pub fn diskDesignator(path: []const u8) -> []const u8 { |
| 180 | | if (!is_windows) |
| 180 | if (is_windows) { |
| 181 | return diskDesignatorWindows(path); |
| 182 | } else { |
| 181 | 183 | return ""; |
| 184 | } |
| 185 | } |
| 182 | 186 | |
| 187 | pub fn diskDesignatorWindows(path: []const u8) -> []const u8 { |
| 183 | 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 | 339 | mem.copy(u8, result, cwd); |
| 335 | 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 | 344 | %defer allocator.free(result); |
| 340 | 345 | |
| ... | ... | @@ -350,7 +355,7 @@ pub fn resolveWindows(allocator: &Allocator, paths: []const []const u8) -> %[]u8 |
| 350 | 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 | 359 | while (it.next()) |component| { |
| 355 | 360 | if (mem.eql(u8, component, ".")) { |
| 356 | 361 | continue; |
| ... | ... | @@ -505,7 +510,7 @@ pub fn dirnameWindows(path: []const u8) -> []const u8 { |
| 505 | 510 | if (path.len == 0) |
| 506 | 511 | return path[0..0]; |
| 507 | 512 | |
| 508 | | const root_slice = diskDesignator(path); |
| 513 | const root_slice = diskDesignatorWindows(path); |
| 509 | 514 | if (path.len == root_slice.len) |
| 510 | 515 | return path; |
| 511 | 516 | |