From a292f77aa8406641344cc1b9b0a6145ef8e50c52 Mon Sep 17 00:00:00 2001 From: Qstick Date: Thu, 31 Aug 2017 21:46:30 -0400 Subject: [PATCH] Sonarr DiskTransferService Updates (#78) * Added a few more files to ignore during file copy. * Tweaked error message when TransferFile destination already exists. --- src/NzbDrone.Common/Disk/DiskTransferService.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Common/Disk/DiskTransferService.cs b/src/NzbDrone.Common/Disk/DiskTransferService.cs index 3f93c11e4..7bfe67ed1 100644 --- a/src/NzbDrone.Common/Disk/DiskTransferService.cs +++ b/src/NzbDrone.Common/Disk/DiskTransferService.cs @@ -223,7 +223,7 @@ namespace NzbDrone.Common.Disk _diskProvider.MoveFile(sourcePath, tempPath, true); try { - ClearTargetPath(targetPath, overwrite); + ClearTargetPath(sourcePath, targetPath, overwrite); _diskProvider.MoveFile(tempPath, targetPath); @@ -253,7 +253,7 @@ namespace NzbDrone.Common.Disk throw new IOException(string.Format("Destination cannot be a child of the source [{0}] => [{1}]", sourcePath, targetPath)); } - ClearTargetPath(targetPath, overwrite); + ClearTargetPath(sourcePath, targetPath, overwrite); if (mode.HasFlag(TransferMode.HardLink)) { @@ -330,7 +330,7 @@ namespace NzbDrone.Common.Disk return TransferMode.None; } - private void ClearTargetPath(string targetPath, bool overwrite) + private void ClearTargetPath(string sourcePath, string targetPath, bool overwrite) { if (_diskProvider.FileExists(targetPath)) { @@ -340,7 +340,7 @@ namespace NzbDrone.Common.Disk } else { - throw new IOException(string.Format("Destination already exists [{0}]", targetPath)); + throw new IOException(string.Format("Destination already exists. [{0}] to [{1}]", sourcePath, targetPath)); } } } @@ -590,7 +590,7 @@ namespace NzbDrone.Common.Disk private bool ShouldIgnore(FileInfo file) { - if (file.Name.StartsWith(".nfs")) + if (file.Name.StartsWith(".nfs") || file.Name == "debug.log" || file.Name.EndsWith(".socket")) { _logger.Trace("Ignoring file {0}", file.FullName); return true;