aboutsummaryrefslogtreecommitdiff
path: root/vendor/libghostty-vt/src/crash/dir.zig
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 21:51:57 +0300
committerGitHub <noreply@github.com>2026-09-10 21:51:57 +0300
commit425c86179791cd32e2d4ce0ae7f269940b4b0663 (patch)
treee52c4383a6d69216cbe2a32638bf90841d7e2189 /vendor/libghostty-vt/src/crash/dir.zig
parent90e947a6e26e02f10ec7f1694c4eb5b78a86406b (diff)
chore: upgrade libghostty and preserve terminal behavior (#3906)
Diffstat (limited to 'vendor/libghostty-vt/src/crash/dir.zig')
-rw-r--r--vendor/libghostty-vt/src/crash/dir.zig28
1 files changed, 14 insertions, 14 deletions
diff --git a/vendor/libghostty-vt/src/crash/dir.zig b/vendor/libghostty-vt/src/crash/dir.zig
index e5a8f8a0..0f877ee3 100644
--- a/vendor/libghostty-vt/src/crash/dir.zig
+++ b/vendor/libghostty-vt/src/crash/dir.zig
@@ -1,12 +1,11 @@
const std = @import("std");
-const assert = std.debug.assert;
const Allocator = std.mem.Allocator;
const internal_os = @import("../os/main.zig");
/// Returns a Dir for the default directory. The Dir.path field must be
/// freed with the given allocator.
-pub fn defaultDir(alloc: Allocator) !Dir {
- const crash_dir = try internal_os.xdg.state(alloc, .{ .subdir = "ghostty/crash" });
+pub fn defaultDir(io: std.Io, alloc: Allocator, environ_map: *const std.process.Environ.Map) !Dir {
+ const crash_dir = try internal_os.xdg.state(io, alloc, environ_map, .{ .subdir = "ghostty/crash" });
errdefer alloc.free(crash_dir);
return .{ .path = crash_dir };
}
@@ -19,12 +18,13 @@ pub const Dir = struct {
/// Returns an iterator over the crash reports in this directory. This
/// iterator must be freed with `ReportIterator.deinit`. The iterator
/// may have no reports.
- pub fn iterator(self: *const Dir) !ReportIterator {
- var dir = std.fs.openDirAbsolute(
+ pub fn iterator(self: *const Dir, io: std.Io) !ReportIterator {
+ var dir = std.Io.Dir.openDirAbsolute(
+ io,
self.path,
.{ .iterate = true },
) catch return .{};
- errdefer dir.close();
+ errdefer dir.close(io);
return .{
.dir = dir,
@@ -34,28 +34,28 @@ pub const Dir = struct {
};
pub const ReportIterator = struct {
- dir: ?std.fs.Dir = null,
- it: std.fs.Dir.Iterator = undefined,
+ dir: ?std.Io.Dir = null,
+ it: std.Io.Dir.Iterator = undefined,
- pub fn deinit(self: *ReportIterator) void {
- if (self.dir) |dir| dir.close();
+ pub fn deinit(self: *ReportIterator, io: std.Io) void {
+ if (self.dir) |dir| dir.close(io);
}
- pub fn next(self: *ReportIterator) !?Report {
+ pub fn next(self: *ReportIterator, io: std.Io) !?Report {
// If we have no dir then we failed to open the directory.
const dir = self.dir orelse return null;
// Get the next file entry, if any.
const entry = entry: while (true) {
- const entry = try self.it.next() orelse return null;
+ const entry = try self.it.next(io) orelse return null;
if (entry.kind != .file) continue;
break :entry entry;
};
- const stat = try dir.statFile(entry.name);
+ const stat = try dir.statFile(io, entry.name, .{});
return .{
.name = entry.name,
- .mtime = stat.mtime,
+ .mtime = stat.mtime.toNanoseconds(),
};
}
};