Fix a whole bunch of issues exposed by ziglang/zig#9191

This also includes a workaround for the fact that @"type" refers to the builtin
and not to a variable called "type". See ziglang/zig#2897.
This commit is contained in:
Robin Voetter
2021-06-24 02:11:36 +02:00
parent b63533d95b
commit b3c71d69ea
10 changed files with 82 additions and 75 deletions

View File

@@ -34,7 +34,7 @@ pub const ResourceGenStep = struct {
return self;
}
fn renderPath(self: *ResourceGenStep, path: []const u8, writer: anytype) void {
fn renderPath(path: []const u8, writer: anytype) void {
const separators = &[_]u8{ std.fs.path.sep_windows, std.fs.path.sep_posix };
var i: usize = 0;
while (std.mem.indexOfAnyPos(u8, path, i, separators)) |j| {
@@ -55,7 +55,7 @@ pub const ResourceGenStep = struct {
var writer = self.resources.writer();
writer.print("pub const {s} = @embedFile(\"", .{name}) catch unreachable;
self.renderPath(shader_out_path, writer);
renderPath(shader_out_path, writer);
writer.writeAll("\");\n") catch unreachable;
}