mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 21:07:33 +08:00
Merge pull request #19563 from peppy/realm-migration-safety
Change migration logic to ignore realm pipe files regardless of database filename
This commit is contained in:
commit
dbdfa90012
@ -26,6 +26,11 @@ namespace osu.Game.IO
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string[] IgnoreFiles => Array.Empty<string>();
|
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)
|
protected MigratableStorage(Storage storage, string subPath = null)
|
||||||
: base(storage, subPath)
|
: base(storage, subPath)
|
||||||
{
|
{
|
||||||
@ -73,6 +78,9 @@ namespace osu.Game.IO
|
|||||||
if (topLevelExcludes && IgnoreFiles.Contains(fi.Name))
|
if (topLevelExcludes && IgnoreFiles.Contains(fi.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (IgnoreSuffixes.Any(suffix => fi.Name.EndsWith(suffix, StringComparison.Ordinal)))
|
||||||
|
continue;
|
||||||
|
|
||||||
allFilesDeleted &= AttemptOperation(() => fi.Delete(), throwOnFailure: false);
|
allFilesDeleted &= AttemptOperation(() => fi.Delete(), throwOnFailure: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +89,9 @@ namespace osu.Game.IO
|
|||||||
if (topLevelExcludes && IgnoreDirectories.Contains(dir.Name))
|
if (topLevelExcludes && IgnoreDirectories.Contains(dir.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (IgnoreSuffixes.Any(suffix => dir.Name.EndsWith(suffix, StringComparison.Ordinal)))
|
||||||
|
continue;
|
||||||
|
|
||||||
allFilesDeleted &= AttemptOperation(() => dir.Delete(true), throwOnFailure: false);
|
allFilesDeleted &= AttemptOperation(() => dir.Delete(true), throwOnFailure: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +112,9 @@ namespace osu.Game.IO
|
|||||||
if (topLevelExcludes && IgnoreFiles.Contains(fileInfo.Name))
|
if (topLevelExcludes && IgnoreFiles.Contains(fileInfo.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (IgnoreSuffixes.Any(suffix => fileInfo.Name.EndsWith(suffix, StringComparison.Ordinal)))
|
||||||
|
continue;
|
||||||
|
|
||||||
AttemptOperation(() =>
|
AttemptOperation(() =>
|
||||||
{
|
{
|
||||||
fileInfo.Refresh();
|
fileInfo.Refresh();
|
||||||
@ -119,6 +133,9 @@ namespace osu.Game.IO
|
|||||||
if (topLevelExcludes && IgnoreDirectories.Contains(dir.Name))
|
if (topLevelExcludes && IgnoreDirectories.Contains(dir.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if (IgnoreSuffixes.Any(suffix => dir.Name.EndsWith(suffix, StringComparison.Ordinal)))
|
||||||
|
continue;
|
||||||
|
|
||||||
CopyRecursive(dir, destination.CreateSubdirectory(dir.Name), false);
|
CopyRecursive(dir, destination.CreateSubdirectory(dir.Name), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,15 +38,20 @@ namespace osu.Game.IO
|
|||||||
public override string[] IgnoreDirectories => new[]
|
public override string[] IgnoreDirectories => new[]
|
||||||
{
|
{
|
||||||
"cache",
|
"cache",
|
||||||
$"{OsuGameBase.CLIENT_DATABASE_FILENAME}.management",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public override string[] IgnoreFiles => new[]
|
public override string[] IgnoreFiles => new[]
|
||||||
{
|
{
|
||||||
"framework.ini",
|
"framework.ini",
|
||||||
"storage.ini",
|
"storage.ini",
|
||||||
$"{OsuGameBase.CLIENT_DATABASE_FILENAME}.note",
|
};
|
||||||
$"{OsuGameBase.CLIENT_DATABASE_FILENAME}.lock",
|
|
||||||
|
public override string[] IgnoreSuffixes => new[]
|
||||||
|
{
|
||||||
|
// Realm pipe files don't play well with copy operations
|
||||||
|
".note",
|
||||||
|
".lock",
|
||||||
|
".management",
|
||||||
};
|
};
|
||||||
|
|
||||||
public OsuStorage(GameHost host, Storage defaultStorage)
|
public OsuStorage(GameHost host, Storage defaultStorage)
|
||||||
|
Loading…
Reference in New Issue
Block a user