diff --git a/DownloadTask.cs b/DownloadTask.cs
index e2ec7d1..c1beecc 100644
--- a/DownloadTask.cs
+++ b/DownloadTask.cs
@@ -58,12 +58,12 @@ internal class DownloadTask : IDisposable {
private bool SupportsHardLinks { get; set; }
///
- /// A mapping of existing file paths to their hashes.
+ /// A mapping of existing file paths to their hashes. Paths are relative.
///
private IReadOnlyDictionary ExistingPathHashes { get; set; } = new Dictionary();
///
- /// A mapping of existing hashes to their file paths.
+ /// A mapping of existing hashes to their file paths. Paths are relative.
///
private IReadOnlyDictionary ExistingHashPaths { get; set; } = new Dictionary();
@@ -740,7 +740,7 @@ internal static string[] GetOutputPaths(IReadOnlyCollection> files
private async Task DuplicateFile(string filesDir, IEnumerable outputPaths, string path) {
if (!this.SupportsHardLinks) {
- // if hard links aren't supported, move the path to the first output
+ // if hard links aren't supported, copy the path to the first output
// path
var firstPath = outputPaths.FirstOrDefault();
if (firstPath == null) {
@@ -753,7 +753,7 @@ private async Task DuplicateFile(string filesDir, IEnumerable outputPath
}
// ReSharper disable once AccessToModifiedClosure
- Plugin.Resilience.Execute(() => File.Move(path, dest));
+ Plugin.Resilience.Execute(() => File.Copy(path, dest));
path = dest;
return;
}
@@ -842,6 +842,7 @@ private async Task DownloadFile(Uri baseUri, string filesPath, string[] outputPa
// find an existing path that has this hash
if (this.ExistingHashPaths.TryGetValue(hash, out var validPath)) {
+ validPath = Path.Join(filesPath, validPath);
goto Duplicate;
}