mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:43:22 +08:00
Fix ignored excluding more than top level
This commit is contained in:
parent
984f27c107
commit
e4a23b3e7d
@ -133,6 +133,9 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
// ensure we "use" cache
|
// ensure we "use" cache
|
||||||
host.Storage.GetStorageForDirectory("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));
|
string defaultStorageLocation = Path.Combine(Environment.CurrentDirectory, "headless", nameof(TestMigration));
|
||||||
|
|
||||||
Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
|
Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
|
||||||
@ -141,6 +144,13 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
|
|
||||||
Assert.That(storage.GetFullPath("."), Is.EqualTo(customPath));
|
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)
|
foreach (var file in OsuStorage.IGNORE_FILES)
|
||||||
{
|
{
|
||||||
Assert.That(host.Storage.Exists(file), Is.True);
|
Assert.That(host.Storage.Exists(file), Is.True);
|
||||||
|
@ -71,7 +71,7 @@ namespace osu.Game.IO
|
|||||||
{
|
{
|
||||||
foreach (System.IO.FileInfo fi in target.GetFiles())
|
foreach (System.IO.FileInfo fi in target.GetFiles())
|
||||||
{
|
{
|
||||||
if (IGNORE_FILES.Contains(fi.Name))
|
if (topLevelExcludes && IGNORE_FILES.Contains(fi.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fi.Delete();
|
fi.Delete();
|
||||||
@ -79,7 +79,7 @@ namespace osu.Game.IO
|
|||||||
|
|
||||||
foreach (DirectoryInfo dir in target.GetDirectories())
|
foreach (DirectoryInfo dir in target.GetDirectories())
|
||||||
{
|
{
|
||||||
if (IGNORE_DIRECTORIES.Contains(dir.Name))
|
if (topLevelExcludes && IGNORE_DIRECTORIES.Contains(dir.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
dir.Delete(true);
|
dir.Delete(true);
|
||||||
@ -93,7 +93,7 @@ namespace osu.Game.IO
|
|||||||
|
|
||||||
foreach (System.IO.FileInfo fi in source.GetFiles())
|
foreach (System.IO.FileInfo fi in source.GetFiles())
|
||||||
{
|
{
|
||||||
if (IGNORE_FILES.Contains(fi.Name))
|
if (topLevelExcludes && IGNORE_FILES.Contains(fi.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int tries = 5;
|
int tries = 5;
|
||||||
@ -114,7 +114,7 @@ namespace osu.Game.IO
|
|||||||
|
|
||||||
foreach (DirectoryInfo dir in source.GetDirectories())
|
foreach (DirectoryInfo dir in source.GetDirectories())
|
||||||
{
|
{
|
||||||
if (IGNORE_DIRECTORIES.Contains(dir.Name))
|
if (topLevelExcludes && IGNORE_DIRECTORIES.Contains(dir.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
copyRecursive(dir, destination.CreateSubdirectory(dir.Name), false);
|
copyRecursive(dir, destination.CreateSubdirectory(dir.Name), false);
|
||||||
|
Loading…
Reference in New Issue
Block a user