Zig 0.16: realPath

This commit is contained in:
LN Liberda 2026-05-22 22:49:58 +02:00
parent a965c5924e
commit 4179f5635a

View file

@ -578,10 +578,9 @@ pub fn main(init: std.process.Init) void {
bin_reader.import();
} else {
var buf: [std.fs.max_path_bytes+1]u8 = @splat(0);
const path =
if (std.posix.realpathZ(scan_dir orelse ".", buf[0..buf.len-1])) |p| buf[0..p.len:0]
else |_| (scan_dir orelse ".");
scan.scan(path) catch |e| ui.die("Error opening directory: {s}.\n", .{ui.errorString(e)});
const dir = std.Io.Dir.cwd().openDir(io, scan_dir orelse ".", .{}) catch |e| ui.die("Error opening directory: {s}.\n", .{ui.errorString(e)});
const path_len = dir.realPath(io, buf[0..buf.len-1]) catch |e| ui.die("Error opening directory: {s}.\n", .{ui.errorString(e)});
scan.scan(buf[0..path_len:0]) catch |e| ui.die("Error opening directory: {s}.\n", .{ui.errorString(e)});
}
if (quit_after_scan or export_json != null or export_bin != null) return;