Change migration logic to ignore realm pipe files regardless of database filename

This commit is contained in:
Dean Herbert
2022-08-03 17:37:30 +09:00
parent 227906e30e
commit f743dc623f
2 changed files with 25 additions and 3 deletions

View File

@ -26,6 +26,11 @@ namespace osu.Game.IO
/// </summary>
public virtual string[] IgnoreFiles => Array.Empty<string>();
/// <summary>
/// A list of file/directory suffixes which should not be migrated.
/// </summary>
public virtual string[] IgnoreSuffixes => Array.Empty<string>();
protected MigratableStorage(Storage storage, string subPath = null)
: base(storage, subPath)
{
@ -73,6 +78,9 @@ namespace osu.Game.IO
if (topLevelExcludes && IgnoreFiles.Contains(fi.Name))
continue;
if (IgnoreSuffixes.Any(suffix => fi.Name.EndsWith(suffix, StringComparison.Ordinal)))
continue;
allFilesDeleted &= AttemptOperation(() => fi.Delete(), throwOnFailure: false);
}
@ -81,6 +89,9 @@ namespace osu.Game.IO
if (topLevelExcludes && IgnoreDirectories.Contains(dir.Name))
continue;
if (IgnoreSuffixes.Any(suffix => dir.Name.EndsWith(suffix, StringComparison.Ordinal)))
continue;
allFilesDeleted &= AttemptOperation(() => dir.Delete(true), throwOnFailure: false);
}
@ -101,6 +112,9 @@ namespace osu.Game.IO
if (topLevelExcludes && IgnoreFiles.Contains(fileInfo.Name))
continue;
if (IgnoreSuffixes.Any(suffix => fileInfo.Name.EndsWith(suffix, StringComparison.Ordinal)))
continue;
AttemptOperation(() =>
{
fileInfo.Refresh();
@ -119,6 +133,9 @@ namespace osu.Game.IO
if (topLevelExcludes && IgnoreDirectories.Contains(dir.Name))
continue;
if (IgnoreSuffixes.Any(suffix => dir.Name.EndsWith(suffix, StringComparison.Ordinal)))
continue;
CopyRecursive(dir, destination.CreateSubdirectory(dir.Name), false);
}
}