| ... | ... | @@ -1433,16 +1433,13 @@ pub fn realpathZ(self: Dir, pathname: [*:0]const u8, out_buffer: []u8) RealPathE |
| 1433 | 1433 | /// See also `Dir.realpath`, `realpathW`. |
| 1434 | 1434 | pub fn realpathW(self: Dir, pathname: []const u16, out_buffer: []u8) RealPathError![]u8 { |
| 1435 | 1435 | var wide_buf: [std.os.windows.PATH_MAX_WIDE]u16 = undefined; |
| 1436 | | |
| 1437 | 1436 | const wide_slice = try self.realpathW2(pathname, &wide_buf); |
| 1438 | 1437 | |
| 1439 | | var big_out_buf: [fs.max_path_bytes]u8 = undefined; |
| 1440 | | const end_index = std.unicode.wtf16LeToWtf8(&big_out_buf, wide_slice); |
| 1441 | | if (end_index > out_buffer.len) |
| 1442 | | return error.NameTooLong; |
| 1443 | | const result = out_buffer[0..end_index]; |
| 1444 | | @memcpy(result, big_out_buf[0..end_index]); |
| 1445 | | return result; |
| 1438 | const len = std.unicode.calcWtf8Len(wide_slice); |
| 1439 | if (len > out_buffer.len) return error.NameTooLong; |
| 1440 | |
| 1441 | const end_index = std.unicode.wtf16LeToWtf8(&out_buffer, wide_slice); |
| 1442 | return out_buffer[0..end_index]; |
| 1446 | 1443 | } |
| 1447 | 1444 | |
| 1448 | 1445 | /// Windows-only. Same as `Dir.realpath` except |