From c164d8b0a603edd5f45b8743c5063bc236ca694d Mon Sep 17 00:00:00 2001 From: Anna Date: Fri, 23 Aug 2024 21:06:10 -0400 Subject: [PATCH] fix: delete destination if exists and copying --- DownloadTask.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DownloadTask.cs b/DownloadTask.cs index 2cdf740..b6510d2 100644 --- a/DownloadTask.cs +++ b/DownloadTask.cs @@ -774,6 +774,10 @@ private async Task DuplicateFile(string filesDir, IEnumerable outputPath var parent = PathHelper.GetParent(dest); Plugin.Resilience.Execute(() => Directory.CreateDirectory(parent)); + if (!await PathHelper.WaitForDelete(dest)) { + throw new DeleteFileException(dest); + } + // ReSharper disable once AccessToModifiedClosure Plugin.Resilience.Execute(() => File.Copy(path, dest)); return;