1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 15:22:55 +08:00

Fix ignored excluding more than top level

This commit is contained in:
Dean Herbert 2020-05-12 12:39:04 +09:00
parent 984f27c107
commit e4a23b3e7d
2 changed files with 14 additions and 4 deletions

View File

@ -133,6 +133,9 @@ namespace osu.Game.Tests.NonVisual
// ensure we "use" cache
host.Storage.GetStorageForDirectory("cache");
// for testing nested files are not ignored (only top level)
host.Storage.GetStorageForDirectory("test-nested").GetStorageForDirectory("cache");
string defaultStorageLocation = Path.Combine(Environment.CurrentDirectory, "headless", nameof(TestMigration));
Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
@ -141,6 +144,13 @@ namespace osu.Game.Tests.NonVisual
Assert.That(storage.GetFullPath("."), Is.EqualTo(customPath));
// ensure cache was not moved
Assert.That(host.Storage.ExistsDirectory("cache"));
// ensure nested cache was moved
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)
{
Assert.That(host.Storage.Exists(file), Is.True);

View File

@ -71,7 +71,7 @@ namespace osu.Game.IO
{
foreach (System.IO.FileInfo fi in target.GetFiles())
{
if (IGNORE_FILES.Contains(fi.Name))
if (topLevelExcludes && IGNORE_FILES.Contains(fi.Name))
continue;
fi.Delete();
@ -79,7 +79,7 @@ namespace osu.Game.IO
foreach (DirectoryInfo dir in target.GetDirectories())
{
if (IGNORE_DIRECTORIES.Contains(dir.Name))
if (topLevelExcludes && IGNORE_DIRECTORIES.Contains(dir.Name))
continue;
dir.Delete(true);
@ -93,7 +93,7 @@ namespace osu.Game.IO
foreach (System.IO.FileInfo fi in source.GetFiles())
{
if (IGNORE_FILES.Contains(fi.Name))
if (topLevelExcludes && IGNORE_FILES.Contains(fi.Name))
continue;
int tries = 5;
@ -114,7 +114,7 @@ namespace osu.Game.IO
foreach (DirectoryInfo dir in source.GetDirectories())
{
if (IGNORE_DIRECTORIES.Contains(dir.Name))
if (topLevelExcludes && IGNORE_DIRECTORIES.Contains(dir.Name))
continue;
copyRecursive(dir, destination.CreateSubdirectory(dir.Name), false);