From 9c0a687e2ac9d621d40038e3b4c35d7731046c11 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Sat, 25 Apr 2026 21:56:27 +0200 Subject: [PATCH] fix(zig-0.16): make setTerminalWorkingDirectory take a hostname parameter Instead of reading from the environment (which requires std.Io). If the application wants to pass something besides `localhost` it can read the environment itself. --- src/Vaxis.zig | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Vaxis.zig b/src/Vaxis.zig index a354fc8b..19aac223 100644 --- a/src/Vaxis.zig +++ b/src/Vaxis.zig @@ -1490,13 +1490,10 @@ pub fn prettyPrint(self: *Vaxis, tty: *std.Io.Writer) !void { } /// Set the terminal's current working directory -pub fn setTerminalWorkingDirectory(_: *Vaxis, tty: *std.Io.Writer, path: []const u8) !void { +pub fn setTerminalWorkingDirectory(_: *Vaxis, tty: *std.Io.Writer, path: []const u8, hostname_: ?[]const u8) !void { if (path.len == 0 or path[0] != '/') return error.InvalidAbsolutePath; - const hostname = switch (builtin.os.tag) { - .windows => null, - else => std.posix.getenv("HOSTNAME"), - } orelse "localhost"; + const hostname = hostname_ orelse "localhost"; const uri: std.Uri = .{ .scheme = "file",