Skip to content

Commit

Permalink
fix: create parent directories for non-links and actually duplicate
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-is-cute committed Aug 22, 2024
1 parent 5f20467 commit f559d64
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions DownloadTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -752,10 +752,12 @@ private async Task DuplicateFile(string filesDir, IEnumerable<string> 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) {
Expand All @@ -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));
}
}

Expand Down

0 comments on commit f559d64

Please sign in to comment.