From f559d64f6814d10f41d5b0daa4ff71ed9d2c365b Mon Sep 17 00:00:00 2001 From: Anna Date: Thu, 22 Aug 2024 07:15:30 -0400 Subject: [PATCH] fix: create parent directories for non-links and actually duplicate --- DownloadTask.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DownloadTask.cs b/DownloadTask.cs index c1beecc..4b9e9d2 100644 --- a/DownloadTask.cs +++ b/DownloadTask.cs @@ -752,10 +752,12 @@ private async Task DuplicateFile(string filesDir, IEnumerable outputPath return; } + var parent = PathHelper.GetParent(dest); + Plugin.Resilience.Execute(() => Directory.CreateDirectory(parent)); + // ReSharper disable once AccessToModifiedClosure Plugin.Resilience.Execute(() => File.Copy(path, dest)); path = dest; - return; } foreach (var outputPath in outputPaths) { @@ -779,7 +781,7 @@ async Task DuplicateInner(string dest) { var parent = PathHelper.GetParent(dest); Plugin.Resilience.Execute(() => Directory.CreateDirectory(parent)); - FileHelper.CreateHardLink(path, dest); + Plugin.Resilience.Execute(() => FileHelper.CreateHardLink(path, dest)); } }