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