Move StoragePath implementation to an extension method

This commit is contained in:
Dean Herbert
2021-11-19 16:07:55 +09:00
parent c6c6b04f2b
commit 59e763467f
23 changed files with 58 additions and 37 deletions

View File

@ -1,7 +1,6 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.IO;
using osu.Game.Database;
namespace osu.Game.IO
@ -12,8 +11,6 @@ namespace osu.Game.IO
public string Hash { get; set; }
public string StoragePath => Path.Combine(Hash.Remove(1), Hash.Remove(2), Hash);
public int ReferenceCount { get; set; }
}
}

View File

@ -12,6 +12,7 @@ using osu.Framework.IO.Stores;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Database;
using osu.Game.Extensions;
namespace osu.Game.IO
{
@ -47,7 +48,7 @@ namespace osu.Game.IO
var info = existing ?? new FileInfo { Hash = hash };
string path = info.StoragePath;
string path = info.GetStoragePath();
// we may be re-adding a file to fix missing store entries.
bool requiresCopy = !Storage.Exists(path);
@ -120,7 +121,7 @@ namespace osu.Game.IO
{
try
{
Storage.Delete(f.StoragePath);
Storage.Delete(f.GetStoragePath());
context.FileInfo.Remove(f);
}
catch (Exception e)