1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00

Delegate file deletion to ImportTask to allow overriding it

This commit is contained in:
Susko3 2023-01-22 22:19:04 +01:00
parent f87bb589a2
commit f8537c1cbe
2 changed files with 11 additions and 2 deletions

View File

@ -51,6 +51,15 @@ namespace osu.Game.Database
: getReaderFrom(Path);
}
/// <summary>
/// Deletes the file that is encapsulated by this <see cref="ImportTask"/>.
/// </summary>
public virtual void DeleteFile()
{
if (File.Exists(Path))
File.Delete(Path);
}
/// <summary>
/// Creates an <see cref="ArchiveReader"/> from a stream.
/// </summary>

View File

@ -201,8 +201,8 @@ namespace osu.Game.Database
// TODO: Add a check to prevent files from storage to be deleted.
try
{
if (import != null && File.Exists(task.Path) && ShouldDeleteArchive(task.Path))
File.Delete(task.Path);
if (import != null && ShouldDeleteArchive(task.Path))
task.DeleteFile();
}
catch (Exception e)
{