mirror of
https://github.com/ppy/osu
synced 2024-12-23 23:33:36 +00:00
Throw exception on copy timeout
This commit is contained in:
parent
49e616b7e5
commit
ad1d050fb4
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user