From 2d8fa9c2f78e91caef5ca11153867f7fef18af40 Mon Sep 17 00:00:00 2001 From: Rekai Musuka Date: Fri, 21 Oct 2022 05:12:30 -0300 Subject: [PATCH] fix: don't create un-needed save file If we don't know if we support a game's save type yet, avoid creating a file for it. --- src/bus/backup.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bus/backup.zig b/src/bus/backup.zig index 0ba3987..ce639b3 100644 --- a/src/bus/backup.zig +++ b/src/bus/backup.zig @@ -102,11 +102,11 @@ pub const Backup = struct { const file_path = try self.getSaveFilePath(path); defer self.alloc.free(file_path); - const file = try std.fs.createFileAbsolute(file_path, .{}); - defer file.close(); - switch (self.kind) { .Sram => { + const file = try std.fs.createFileAbsolute(file_path, .{}); + defer file.close(); + try file.writeAll(self.buf); log.info("Dumped SRAM to {s}", .{file_path}); },