This commit is contained in:
Jarred Sumner
2023-09-05 05:11:39 -08:00
parent e2d3bdd6b3
commit ebc64f2b4d
12 changed files with 19 additions and 32 deletions

View File

@@ -1494,7 +1494,7 @@ pub fn toWObjectPath(wbuf: []u16, utf8: []const u8) [:0]const u16 {
}
wbuf[0..4].* = [_]u16{ '\\', '?', '?', '\\' };
return wbuf[0..toWPathNormalized(wbuf[4..], utf8).len + 4:0];
return wbuf[0 .. toWPathNormalized(wbuf[4..], utf8).len + 4 :0];
}
// These are the same because they don't have rules like needing a trailing slash
@@ -1551,10 +1551,9 @@ pub fn toWPathMaybeDir(wbuf: []u16, utf8: []const u8, comptime add_trailing_lash
std.debug.assert(wbuf.len > 0);
var result = bun.simdutf.convert.utf8.to.utf16.with_errors.le(
utf8,
wbuf[0..wbuf.len -| (1 + @as(usize, @intFromBool( add_trailing_lash)))],
wbuf[0..wbuf.len -| (1 + @as(usize, @intFromBool(add_trailing_lash)))],
);
if (add_trailing_lash and result.count > 0 and wbuf[result.count - 1] != '\\') {
wbuf[result.count] = '\\';
result.count += 1;