1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

Another mono 6.x workaround to use rename rather than expensive copy

This commit is contained in:
Taloth Saldono 2020-04-18 10:55:08 +02:00
parent 776191b3bd
commit 576275b6da

View File

@ -231,6 +231,18 @@ private void TransferFilePatched(string source, string destination, bool overwri
// - In 6.6 it'll leave a zero length file
// Catch the exception and attempt to handle these edgecases
// Mono 6.x till 6.10 doesn't properly try use rename first.
if (move && PlatformInfo.GetVersion() < new Version(6, 10))
{
if (Syscall.lstat(source, out var sourcestat) == 0 &&
Syscall.lstat(destination, out var deststat) != 0 &&
Syscall.rename(source, destination) == 0)
{
_logger.Trace("Moved '{0}' -> '{1}' using Syscall.rename", source, destination);
return;
}
}
try
{
if (move)