1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:35:10 +08:00

make ignore properties protected virtual get-only in base

This commit is contained in:
Shivam 2020-06-23 23:34:26 +02:00
parent a899c754f1
commit a47d34f1db
3 changed files with 26 additions and 10 deletions

View File

@ -126,6 +126,7 @@ namespace osu.Game.Tests.NonVisual
{
var osu = loadOsu(host);
var storage = osu.Dependencies.Get<Storage>();
var osuStorage = storage as OsuStorage;
// ensure we perform a save
host.Dependencies.Get<FrameworkConfigManager>().Save();
@ -151,13 +152,13 @@ namespace osu.Game.Tests.NonVisual
Assert.That(!host.Storage.ExistsDirectory(Path.Combine("test-nested", "cache")));
Assert.That(storage.ExistsDirectory(Path.Combine("test-nested", "cache")));
foreach (var file in MigratableStorage.IGNORE_FILES)
foreach (var file in osuStorage.IGNORE_FILES)
{
Assert.That(host.Storage.Exists(file), Is.True);
Assert.That(storage.Exists(file), Is.False);
}
foreach (var dir in MigratableStorage.IGNORE_DIRECTORIES)
foreach (var dir in osuStorage.IGNORE_DIRECTORIES)
{
Assert.That(host.Storage.ExistsDirectory(dir), Is.True);
Assert.That(storage.ExistsDirectory(dir), Is.False);

View File

@ -14,13 +14,8 @@ namespace osu.Game.IO
/// </summary>
public abstract class MigratableStorage : WrappedStorage
{
internal static readonly string[] IGNORE_DIRECTORIES = { "cache" };
internal static readonly string[] IGNORE_FILES =
{
"framework.ini",
"storage.ini"
};
internal virtual string[] IGNORE_DIRECTORIES { get; }
internal virtual string[] IGNORE_FILES { get; }
protected MigratableStorage(Storage storage, string subPath = null)
: base(storage, subPath)

View File

@ -14,6 +14,26 @@ namespace osu.Game.IO
private readonly GameHost host;
private readonly StorageConfigManager storageConfig;
internal override string[] IGNORE_DIRECTORIES
{
get
{
return new string[] { "cache" };
}
}
internal override string[] IGNORE_FILES
{
get
{
return new string[]
{
"framework.ini",
"storage.ini"
};
}
}
public OsuStorage(GameHost host)
: base(host.Storage, string.Empty)
{