mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 11:42:54 +08:00
Address formatting issues
This commit is contained in:
parent
9d2392b6b1
commit
c32ef5e718
@ -152,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 osuStorage.IGNORE_FILES)
|
||||
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.IGNORE_DIRECTORIES)
|
||||
foreach (var dir in osuStorage.IgnoreDirectories)
|
||||
{
|
||||
Assert.That(host.Storage.ExistsDirectory(dir), Is.True);
|
||||
Assert.That(storage.ExistsDirectory(dir), Is.False);
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Tournament.IO
|
||||
Logger.Log("Using tournament storage: " + GetFullPath(string.Empty));
|
||||
}
|
||||
|
||||
override public void Migrate(string newLocation)
|
||||
public override void Migrate(string newLocation)
|
||||
{
|
||||
var source = new DirectoryInfo(storage.GetFullPath("tournament"));
|
||||
var destination = new DirectoryInfo(newLocation);
|
||||
|
@ -14,21 +14,21 @@ namespace osu.Game.IO
|
||||
/// </summary>
|
||||
public abstract class MigratableStorage : WrappedStorage
|
||||
{
|
||||
internal virtual string[] IGNORE_DIRECTORIES { get; }
|
||||
internal virtual string[] IGNORE_FILES { get; }
|
||||
internal virtual string[] IgnoreDirectories => new string[] { };
|
||||
internal virtual string[] IgnoreFiles => new string[] { };
|
||||
|
||||
protected MigratableStorage(Storage storage, string subPath = null)
|
||||
: base(storage, subPath)
|
||||
{
|
||||
}
|
||||
|
||||
abstract public void Migrate(string newLocation);
|
||||
public abstract void Migrate(string newLocation);
|
||||
|
||||
protected void DeleteRecursive(DirectoryInfo target, bool topLevelExcludes = true)
|
||||
{
|
||||
foreach (System.IO.FileInfo fi in target.GetFiles())
|
||||
{
|
||||
if (topLevelExcludes && IGNORE_FILES.Contains(fi.Name))
|
||||
if (topLevelExcludes && IgnoreFiles.Contains(fi.Name))
|
||||
continue;
|
||||
|
||||
AttemptOperation(() => fi.Delete());
|
||||
@ -36,7 +36,7 @@ namespace osu.Game.IO
|
||||
|
||||
foreach (DirectoryInfo dir in target.GetDirectories())
|
||||
{
|
||||
if (topLevelExcludes && IGNORE_DIRECTORIES.Contains(dir.Name))
|
||||
if (topLevelExcludes && IgnoreDirectories.Contains(dir.Name))
|
||||
continue;
|
||||
|
||||
AttemptOperation(() => dir.Delete(true));
|
||||
@ -54,7 +54,7 @@ namespace osu.Game.IO
|
||||
|
||||
foreach (System.IO.FileInfo fi in source.GetFiles())
|
||||
{
|
||||
if (topLevelExcludes && IGNORE_FILES.Contains(fi.Name))
|
||||
if (topLevelExcludes && IgnoreFiles.Contains(fi.Name))
|
||||
continue;
|
||||
|
||||
AttemptOperation(() => fi.CopyTo(Path.Combine(destination.FullName, fi.Name), true));
|
||||
@ -62,7 +62,7 @@ namespace osu.Game.IO
|
||||
|
||||
foreach (DirectoryInfo dir in source.GetDirectories())
|
||||
{
|
||||
if (topLevelExcludes && IGNORE_DIRECTORIES.Contains(dir.Name))
|
||||
if (topLevelExcludes && IgnoreDirectories.Contains(dir.Name))
|
||||
continue;
|
||||
|
||||
CopyRecursive(dir, destination.CreateSubdirectory(dir.Name), false);
|
||||
|
@ -14,25 +14,13 @@ 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[] IgnoreDirectories => new[] { "cache" };
|
||||
|
||||
internal override string[] IGNORE_FILES
|
||||
internal override string[] IgnoreFiles => new[]
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[]
|
||||
{
|
||||
"framework.ini",
|
||||
"storage.ini"
|
||||
};
|
||||
}
|
||||
}
|
||||
"framework.ini",
|
||||
"storage.ini"
|
||||
};
|
||||
|
||||
public OsuStorage(GameHost host)
|
||||
: base(host.Storage, string.Empty)
|
||||
@ -53,7 +41,7 @@ namespace osu.Game.IO
|
||||
Logger.Storage = UnderlyingStorage.GetStorageForDirectory("logs");
|
||||
}
|
||||
|
||||
override public void Migrate(string newLocation)
|
||||
public override void Migrate(string newLocation)
|
||||
{
|
||||
var source = new DirectoryInfo(GetFullPath("."));
|
||||
var destination = new DirectoryInfo(newLocation);
|
||||
|
Loading…
Reference in New Issue
Block a user