diff options
Diffstat (limited to 'src/panto_home.zig')
| -rw-r--r-- | src/panto_home.zig | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/panto_home.zig b/src/panto_home.zig index b7c1799..353e54b 100644 --- a/src/panto_home.zig +++ b/src/panto_home.zig @@ -30,6 +30,11 @@ pub const Layout = struct { allocator: Allocator, /// `$PANTO_HOME` itself. home: []u8, + /// `$PANTO_HOME/agent/` — the "system" extension/tool tree, + /// populated at bootstrap from files embedded into the panto + /// binary. Searched after user/project layers for tools and + /// extensions; project shadows user shadows system. + agent_dir: []u8, /// `$PANTO_HOME/rocks/lua-<lua_version>/` — the versioned tree. tree: []u8, /// `<tree>/include/` — where Lua headers are staged. @@ -52,6 +57,7 @@ pub const Layout = struct { pub fn deinit(self: Layout) void { const a = self.allocator; a.free(self.home); + a.free(self.agent_dir); a.free(self.tree); a.free(self.include_dir); a.free(self.share_lua_dir); @@ -76,6 +82,9 @@ pub fn resolve( const home = try resolveHome(allocator, environ_map); errdefer allocator.free(home); + const agent_dir = try std.fs.path.join(allocator, &.{ home, "agent" }); + errdefer allocator.free(agent_dir); + // `<home>/rocks/lua-<lua_version>` const tree_subdir = try std.fmt.allocPrint( allocator, @@ -111,6 +120,7 @@ pub fn resolve( return .{ .allocator = allocator, .home = home, + .agent_dir = agent_dir, .tree = tree, .include_dir = include_dir, .share_lua_dir = share_lua_dir, @@ -143,6 +153,7 @@ fn resolveHome( /// — existing directories are left alone. pub fn ensureDirsExist(layout: Layout, io: Io) !void { try makePathRecursive(io, layout.home); + try makePathRecursive(io, layout.agent_dir); try makePathRecursive(io, layout.tree); try makePathRecursive(io, layout.include_dir); try makePathRecursive(io, layout.share_lua_dir); |
