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.
This commit is contained in:
Rekai Nyangadzayi Musuka 2022-03-22 15:03:05 -03:00
parent 4c172cff70
commit 37c039fb92
1 changed files with 3 additions and 3 deletions

View File

@ -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});
},