diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/vfs.zig | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/vfs.zig b/src/lib/vfs.zig index 5bb8ca4..e424493 100644 --- a/src/lib/vfs.zig +++ b/src/lib/vfs.zig @@ -4,6 +4,8 @@ const std = @import("std"); +const mem = std.mem; + var root = undefined; pub const Error = error{ @@ -40,10 +42,10 @@ pub const Inode = struct { pub const Node = std.DoublyLinkedList(Inode).Node; pub const Tree = struct { - allocator: std.mem.Allocator, + allocator: mem.Allocator, nodes: std.DoublyLinkedList(Inode), - pub fn init(allocator: std.mem.Allocator) Tree { + pub fn init(allocator: mem.Allocator) Tree { return .{ .allocator = allocator, .nodes = std.DoublyLinkedList(Inode){}, @@ -74,7 +76,7 @@ pub const Tree = struct { } }; -pub fn init(allocator: std.mem.Allocator) void { +pub fn init(allocator: mem.Allocator) void { root = Tree.init(allocator); } @@ -109,3 +111,7 @@ pub fn provideResource(path: []const u8, resource: Resource) !void { } else return Error.NotADirectory; } else return Error.NotFound; } + +pub fn provideResourceZ(path_c: [*:0]const u8, resource: Resource) !void { + return provideResource(mem.sliceTo(path_c, 0), resource); +} |