Don't remove imported archives by default

This commit is contained in:
HoLLy 2019-06-27 14:41:11 +02:00
parent 55216dffb7
commit 12350d18b5
3 changed files with 10 additions and 1 deletions

View File

@ -83,6 +83,8 @@ namespace osu.Game.Beatmaps
protected override IEnumerable<string> GetStableImportPaths() => GetStableStorage().GetDirectories(ImportFromStablePath);
protected override bool ShouldRemoveArchive(string path) => Path.GetExtension(path)?.ToLowerInvariant() == ".osz";
protected override Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
{
if (archive != null)

View File

@ -176,7 +176,7 @@ namespace osu.Game.Database
// TODO: Add a check to prevent files from storage to be deleted.
try
{
if (import != null && File.Exists(path))
if (import != null && File.Exists(path) && ShouldRemoveArchive(path))
File.Delete(path);
}
catch (Exception e)
@ -503,6 +503,11 @@ namespace osu.Game.Database
/// </summary>
protected abstract IEnumerable<string> GetStableImportPaths();
/// <summary>
/// Should this archive be removed after importing?
/// </summary>
protected virtual bool ShouldRemoveArchive(string path) => false;
/// <summary>
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
/// </summary>

View File

@ -56,6 +56,8 @@ namespace osu.Game.Skinning
protected override IEnumerable<string> GetStableImportPaths() => GetStableStorage().GetDirectories(ImportFromStablePath);
protected override bool ShouldRemoveArchive(string path) => true;
/// <summary>
/// Returns a list of all usable <see cref="SkinInfo"/>s. Includes the special default skin plus all skins from <see cref="GetAllUserSkins"/>.
/// </summary>