mirror of
https://github.com/osukey/osukey.git
synced 2025-06-23 12:18:03 +09: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))
|
if (topLevelExcludes && IGNORE_FILES.Contains(fi.Name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int tries = 5;
|
attemptCopy(fi, Path.Combine(destination.FullName, fi.Name));
|
||||||
|
|
||||||
while (tries-- > 0)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fi.CopyTo(Path.Combine(destination.FullName, fi.Name), true);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
Thread.Sleep(50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (DirectoryInfo dir in source.GetDirectories())
|
foreach (DirectoryInfo dir in source.GetDirectories())
|
||||||
@ -120,5 +107,26 @@ namespace osu.Game.IO
|
|||||||
copyRecursive(dir, destination.CreateSubdirectory(dir.Name), false);
|
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…
x
Reference in New Issue
Block a user