1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 00:42:55 +08:00

Merge pull request #3875 from UselessToucan/do_not_delete_replay_on_import

Do not delete file on import failure
This commit is contained in:
Dean Herbert 2018-12-19 14:12:04 +09:00 committed by GitHub
commit 4545661347
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)