Only delete on successful import.

This commit is contained in:
Mikal Stodal 2017-02-28 14:46:16 +01:00
parent 7e72911d3a
commit eff66a1da6
1 changed files with 5 additions and 7 deletions

View File

@ -126,13 +126,7 @@ public void Import(IEnumerable<string> 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<string> 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);