1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:43:04 +08:00

Do not delete file on import failure

This commit is contained in:
Roman Kapustin 2018-12-18 22:49:53 +03:00
parent 4b0cad1455
commit 4a1af67893

View File

@ -149,8 +149,10 @@ namespace osu.Game.Database
try
{
notification.Text = $"Importing ({++current} of {paths.Length})\n{Path.GetFileName(path)}";
TModel import;
using (ArchiveReader reader = getReaderFrom(path))
imported.Add(Import(reader));
imported.Add(import = Import(reader));
notification.Progress = (float)current / paths.Length;
@ -160,7 +162,7 @@ namespace osu.Game.Database
// TODO: Add a check to prevent files from storage to be deleted.
try
{
if (File.Exists(path))
if (import != null && File.Exists(path))
File.Delete(path);
}
catch (Exception e)