Files
Andrew Kelley b1d1806fef std.process: currentDir -> currentPath
In Zig standard library, Dir means an open directory handle. path
represents a file system identifier string. This function is better
named after "current path" than "current dir". "get" and "working" are
superfluous.
2026-01-29 18:47:58 -08:00

17 lines
565 B
Zig

const std = @import("std");
pub fn main(init: std.process.Init) !void {
const arena = init.arena.allocator();
const args = try init.minimal.args.toSlice(arena);
const io = init.io;
const cwd_path = try std.process.currentPathAlloc(io, arena);
if (args.len < 3) return error.MissingArgs;
const relative = try std.fs.path.relative(arena, cwd_path, init.environ_map, args[1], args[2]);
var stdout_writer = std.Io.File.stdout().writerStreaming(io, &.{});
const stdout = &stdout_writer.interface;
try stdout.writeAll(relative);
}