1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00

Merge pull request #19514 from peppy/dont-throw-copy-failure-migration

Fix migration failing on single file copy failure
This commit is contained in:
Dean Herbert 2022-08-01 17:43:05 +09:00 committed by GitHub
commit 14c2348df7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,12 +96,22 @@ namespace osu.Game.IO
if (!destination.Exists)
Directory.CreateDirectory(destination.FullName);
foreach (System.IO.FileInfo fi in source.GetFiles())
foreach (System.IO.FileInfo fileInfo in source.GetFiles())
{
if (topLevelExcludes && IgnoreFiles.Contains(fi.Name))
if (topLevelExcludes && IgnoreFiles.Contains(fileInfo.Name))
continue;
AttemptOperation(() => fi.CopyTo(Path.Combine(destination.FullName, fi.Name), true));
AttemptOperation(() =>
{
fileInfo.Refresh();
// A temporary file may have been deleted since the initial GetFiles operation.
// We don't want the whole migration process to fail in such a case.
if (!fileInfo.Exists)
return;
fileInfo.CopyTo(Path.Combine(destination.FullName, fileInfo.Name), true);
});
}
foreach (DirectoryInfo dir in source.GetDirectories())