mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-11-03 21:49:42 -09:00
Zig 0.16: realPath
This commit is contained in:
parent
a965c5924e
commit
4179f5635a
1 changed files with 3 additions and 4 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue