From eff66a1da6a0d1a0d316726f279774750ed048b8 Mon Sep 17 00:00:00 2001 From: Mikal Stodal Date: Tue, 28 Feb 2017 14:46:16 +0100 Subject: [PATCH] Only delete on successful import. --- osu.Game/Database/BeatmapDatabase.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 9292fbab49..74d9b04039 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -126,13 +126,7 @@ public void Import(IEnumerable paths) BeatmapSetInfo set = importBeatmapSet(p); sets.Push(set); - } - catch (Exception e) - { - Logger.Error(e, $@"Could not import beatmap set"); - } - finally - { + // We may or may not want to delete the file depending on where it is stored. // e.g. reconstructing/repairing database with beatmaps from default storage. // TODO: Add a check to prevent files from storage to be deleted. @@ -145,6 +139,10 @@ public void Import(IEnumerable paths) Logger.Error(e, $@"Could not delete file at {p}"); } } + catch (Exception e) + { + Logger.Error(e, $@"Could not import beatmap set"); + } // Batch commit with multiple sets to database Import(sets);