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-10-21 05:12:30 -03:00
parent a93b335dea
commit 2d8fa9c2f7
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);
switch (self.kind) {
.Sram => {
const file = try std.fs.createFileAbsolute(file_path, .{});
defer file.close();
switch (self.kind) {
.Sram => {
try file.writeAll(self.buf);
log.info("Dumped SRAM to {s}", .{file_path});
},