Skip to content

Commit

Permalink
fix: delete destination if exists and copying
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-is-cute committed Aug 24, 2024
1 parent ee826e5 commit c164d8b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions DownloadTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,10 @@ private async Task DuplicateFile(string filesDir, IEnumerable<string> 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;
Expand Down

0 comments on commit c164d8b

Please sign in to comment.