mirror of https://github.com/fairyglade/ly.git
migrator: Free old save path later
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
parent
e1696a4e73
commit
acb532b5d4
|
|
@ -289,8 +289,6 @@ pub fn tryMigrateIniSaveFile(allocator: std.mem.Allocator, io: std.Io, path: []c
|
|||
|
||||
fn tryMigrateFirstSaveFile(io: std.Io, user_buf: *[32]u8) ?OldSave {
|
||||
if (maybe_save_file) |path| {
|
||||
defer temporary_allocator.free(path);
|
||||
|
||||
var save = OldSave{};
|
||||
var file = std.Io.Dir.openFileAbsolute(io, path, .{}) catch return null;
|
||||
defer file.close(io);
|
||||
|
|
|
|||
|
|
@ -1648,6 +1648,7 @@ fn authenticate(ptr: *anyopaque) !bool {
|
|||
|
||||
// Delete previous save file if it exists
|
||||
if (migrator.maybe_save_file) |path| {
|
||||
defer temporary_allocator.free(path);
|
||||
std.Io.Dir.cwd().deleteFile(state.io, path) catch {};
|
||||
} else if (state.has_old_save) {
|
||||
std.Io.Dir.cwd().deleteFile(state.io, state.old_save_path) catch {};
|
||||
|
|
|
|||
Loading…
Reference in New Issue