core: add a .txt extenstion to scrollback file

This should make it easier for open or xdg-open to find an appropriate
application to open the scrollback file with.
This commit is contained in:
Jeffrey C. Ollie
2024-10-27 15:58:51 -05:00
parent e26847ccd4
commit 348287c620

View File

@ -4118,9 +4118,13 @@ fn writeScreenFile(
var tmp_dir = try internal_os.TempDir.init();
errdefer tmp_dir.deinit();
var filename_buf: [std.fs.max_path_bytes]u8 = undefined;
const filename = try std.fmt.bufPrint(&filename_buf, "{s}.txt", .{@tagName(loc)});
// Open our scrollback file
var file = try tmp_dir.dir.createFile(@tagName(loc), .{});
var file = try tmp_dir.dir.createFile(filename, .{});
defer file.close();
// Screen.dumpString writes byte-by-byte, so buffer it
var buf_writer = std.io.bufferedWriter(file.writer());
@ -4179,7 +4183,7 @@ fn writeScreenFile(
// Get the final path
var path_buf: [std.fs.max_path_bytes]u8 = undefined;
const path = try tmp_dir.dir.realpath(@tagName(loc), &path_buf);
const path = try tmp_dir.dir.realpath(filename, &path_buf);
switch (write_action) {
.open => try internal_os.open(self.alloc, path),