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); : 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> /// <summary>
/// Creates an <see cref="ArchiveReader"/> from a stream. /// Creates an <see cref="ArchiveReader"/> from a stream.
/// </summary> /// </summary>

View File

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