fix(bundler): fix --compile with asset files on windows (#10385)

* fix some bundler things

* buh

* buh

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
This commit is contained in:
dave caruso
2024-04-20 17:13:50 -07:00
committed by GitHub
parent ad44949621
commit a062e2d367
7 changed files with 57 additions and 41 deletions

View File

@@ -32,6 +32,17 @@ pub inline fn contains(self: string, str: string) bool {
return indexOf(self, str) != null;
}
pub inline fn removeLeadingDotSlash(slice: []const u8) []const u8 {
if (slice.len >= 2) {
if ((@as(u16, @bitCast(slice[0..2].*)) == comptime std.mem.readInt(u16, "./", .little)) or
(Environment.isWindows and @as(u16, @bitCast(slice[0..2].*)) == comptime std.mem.readInt(u16, ".\\", .little)))
{
return slice[2..];
}
}
return slice;
}
pub inline fn w(comptime str: []const u8) [:0]const u16 {
if (!@inComptime()) @compileError("strings.w() must be called in a comptime context");
comptime var output: [str.len + 1]u16 = undefined;