model3d: update to latest Zig build API
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
ca062e08fe
commit
ae06ca541f
2 changed files with 34 additions and 18 deletions
|
|
@ -216,7 +216,7 @@ fn intToError(int: c_int) Error {
|
|||
test {
|
||||
testing.refAllDeclsRecursive(@This());
|
||||
|
||||
var model_file = try std.fs.cwd().openFile("assets/cube.m3d", .{});
|
||||
var model_file = try std.fs.cwd().openFile( thisDir("/../assets/cube.m3d"), .{});
|
||||
defer model_file.close();
|
||||
var model_data = try model_file.readToEndAllocOptions(testing.allocator, 1024, 119, @alignOf(u8), 0);
|
||||
defer testing.allocator.free(model_data);
|
||||
|
|
@ -229,3 +229,11 @@ test {
|
|||
defer std.heap.c_allocator.free(out);
|
||||
try testing.expect(out.len >= 119);
|
||||
}
|
||||
|
||||
fn thisDir(comptime suffix: []const u8) []const u8 {
|
||||
if (suffix[0] != '/') @compileError("suffix must be an absolute path");
|
||||
return comptime blk: {
|
||||
const root_dir = std.fs.path.dirname(@src().file) orelse ".";
|
||||
break :blk root_dir ++ suffix;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue