mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:43:00 +08:00
Address review comments
Now asserting instead of an if-statement, change cast from OsuStorage to MigratableStorage and make internal virtual properties protected.
This commit is contained in:
parent
063503f4db
commit
47a732ef60
@ -126,7 +126,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
var storage = osu.Dependencies.Get<Storage>();
|
||||
var osuStorage = storage as OsuStorage;
|
||||
var osuStorage = storage as MigratableStorage;
|
||||
|
||||
// ensure we perform a save
|
||||
host.Dependencies.Get<FrameworkConfigManager>().Save();
|
||||
@ -152,19 +152,18 @@ namespace osu.Game.Tests.NonVisual
|
||||
Assert.That(!host.Storage.ExistsDirectory(Path.Combine("test-nested", "cache")));
|
||||
Assert.That(storage.ExistsDirectory(Path.Combine("test-nested", "cache")));
|
||||
|
||||
if (osuStorage != null)
|
||||
{
|
||||
foreach (var file in osuStorage.IgnoreFiles)
|
||||
{
|
||||
Assert.That(host.Storage.Exists(file), Is.True);
|
||||
Assert.That(storage.Exists(file), Is.False);
|
||||
}
|
||||
Assert.That(osuStorage, Is.Not.Null);
|
||||
|
||||
foreach (var dir in osuStorage.IgnoreDirectories)
|
||||
{
|
||||
Assert.That(host.Storage.ExistsDirectory(dir), Is.True);
|
||||
Assert.That(storage.ExistsDirectory(dir), Is.False);
|
||||
}
|
||||
foreach (var file in osuStorage.IgnoreFiles)
|
||||
{
|
||||
Assert.That(host.Storage.Exists(file), Is.True);
|
||||
Assert.That(storage.Exists(file), Is.False);
|
||||
}
|
||||
|
||||
foreach (var dir in osuStorage.IgnoreDirectories)
|
||||
{
|
||||
Assert.That(host.Storage.ExistsDirectory(dir), Is.True);
|
||||
Assert.That(storage.ExistsDirectory(dir), Is.False);
|
||||
}
|
||||
|
||||
Assert.That(new StreamReader(host.Storage.GetStream("storage.ini")).ReadToEnd().Contains($"FullPath = {customPath}"));
|
||||
|
@ -14,8 +14,8 @@ namespace osu.Game.IO
|
||||
/// </summary>
|
||||
public abstract class MigratableStorage : WrappedStorage
|
||||
{
|
||||
internal virtual string[] IgnoreDirectories => Array.Empty<string>();
|
||||
internal virtual string[] IgnoreFiles => Array.Empty<string>();
|
||||
public virtual string[] IgnoreDirectories => Array.Empty<string>();
|
||||
public virtual string[] IgnoreFiles => Array.Empty<string>();
|
||||
|
||||
protected MigratableStorage(Storage storage, string subPath = null)
|
||||
: base(storage, subPath)
|
||||
|
@ -14,9 +14,9 @@ namespace osu.Game.IO
|
||||
private readonly GameHost host;
|
||||
private readonly StorageConfigManager storageConfig;
|
||||
|
||||
internal override string[] IgnoreDirectories => new[] { "cache" };
|
||||
public override string[] IgnoreDirectories => new[] { "cache" };
|
||||
|
||||
internal override string[] IgnoreFiles => new[]
|
||||
public override string[] IgnoreFiles => new[]
|
||||
{
|
||||
"framework.ini",
|
||||
"storage.ini"
|
||||
|
Loading…
Reference in New Issue
Block a user