diff --git a/osu.Game/IO/OsuStorage.cs b/osu.Game/IO/OsuStorage.cs index b060add03b..71b01ce479 100644 --- a/osu.Game/IO/OsuStorage.cs +++ b/osu.Game/IO/OsuStorage.cs @@ -96,20 +96,7 @@ namespace osu.Game.IO if (topLevelExcludes && IGNORE_FILES.Contains(fi.Name)) continue; - int tries = 5; - - while (tries-- > 0) - { - try - { - fi.CopyTo(Path.Combine(destination.FullName, fi.Name), true); - break; - } - catch (Exception) - { - Thread.Sleep(50); - } - } + attemptCopy(fi, Path.Combine(destination.FullName, fi.Name)); } foreach (DirectoryInfo dir in source.GetDirectories()) @@ -120,5 +107,26 @@ namespace osu.Game.IO copyRecursive(dir, destination.CreateSubdirectory(dir.Name), false); } } + + private static void attemptCopy(System.IO.FileInfo fileInfo, string destination) + { + int tries = 5; + + while (true) + { + try + { + fileInfo.CopyTo(destination, true); + return; + } + catch (Exception) + { + if (tries-- == 0) + throw; + } + + Thread.Sleep(50); + } + } } }