| ... | ... | @@ -1347,13 +1347,11 @@ pub fn realpathW(self: Dir, pathname: []const u16, out_buffer: []u8) RealPathErr |
| 1347 | 1347 | |
| 1348 | 1348 | var wide_buf: [w.PATH_MAX_WIDE]u16 = undefined; |
| 1349 | 1349 | const wide_slice = try w.GetFinalPathNameByHandle(h_file, .{}, &wide_buf); |
| 1350 | | var big_out_buf: [fs.max_path_bytes]u8 = undefined; |
| 1351 | | const end_index = std.unicode.wtf16LeToWtf8(&big_out_buf, wide_slice); |
| 1352 | | if (end_index > out_buffer.len) |
| 1350 | const len = std.unicode.calcWtf8Len(wide_slice); |
| 1351 | if (len > out_buffer.len) |
| 1353 | 1352 | return error.NameTooLong; |
| 1354 | | const result = out_buffer[0..end_index]; |
| 1355 | | @memcpy(result, big_out_buf[0..end_index]); |
| 1356 | | return result; |
| 1353 | const end_index = std.unicode.wtf16LeToWtf8(out_buffer, wide_slice); |
| 1354 | return out_buffer[0..end_index]; |
| 1357 | 1355 | } |
| 1358 | 1356 | |
| 1359 | 1357 | pub const RealPathAllocError = RealPathError || Allocator.Error; |