This commit is contained in:
chloe caruso
2025-01-16 14:26:13 -08:00
parent 89b7698cd9
commit 43acf18824
8 changed files with 493 additions and 134 deletions

View File

@@ -1916,19 +1916,7 @@ pub fn toNTPath(wbuf: []u16, utf8: []const u8) [:0]u16 {
return wbuf[0 .. toWPathNormalized(wbuf[prefix.len..], utf8).len + prefix.len :0];
}
pub fn toNTMaxPath(buf: []u8, utf8: []const u8) [:0]const u8 {
if (!std.fs.path.isAbsoluteWindows(utf8) or utf8.len <= 260) {
@memcpy(buf[0..utf8.len], utf8);
buf[utf8.len] = 0;
return buf[0..utf8.len :0];
}
const prefix = bun.windows.nt_maxpath_prefix_u8;
buf[0..prefix.len].* = prefix;
return buf[0 .. toPathNormalized(buf[prefix.len..], utf8).len + prefix.len :0];
}
pub fn addNTPathPrefix(wbuf: []u16, utf16: []const u16) [:0]u16 {
fn addNTPathPrefix(wbuf: []u16, utf16: []const u16) [:0]u16 {
wbuf[0..bun.windows.nt_object_prefix.len].* = bun.windows.nt_object_prefix;
@memcpy(wbuf[bun.windows.nt_object_prefix.len..][0..utf16.len], utf16);
wbuf[utf16.len + bun.windows.nt_object_prefix.len] = 0;