From 576275b6dad7a909a0dcdd077d94e10d5efaef45 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Sat, 18 Apr 2020 10:55:08 +0200 Subject: [PATCH] Another mono 6.x workaround to use rename rather than expensive copy --- src/NzbDrone.Mono/Disk/DiskProvider.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/NzbDrone.Mono/Disk/DiskProvider.cs b/src/NzbDrone.Mono/Disk/DiskProvider.cs index d2200deb8..0e0b43077 100644 --- a/src/NzbDrone.Mono/Disk/DiskProvider.cs +++ b/src/NzbDrone.Mono/Disk/DiskProvider.cs @@ -231,6 +231,18 @@ namespace NzbDrone.Mono.Disk // - 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)