Skip to content

Commit

Permalink
Fixes an issue where if multiple torrents had files with the same pat…
Browse files Browse the repository at this point in the history
…h data would be read/written to the wrong file.

svn path=/branches/bitsharp-0.70/; revision=129361
  • Loading branch information
alanmcgovern committed Mar 14, 2009
1 parent dc83439 commit cbff540
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/MonoTorrent/MonoTorrent.Client/PieceWriter/DiskWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ public override void Dispose()

protected virtual string GenerateFilePath(TorrentFile file, string path)
{
if (paths.ContainsKey(file))
return paths[file];
return Path.Combine(path, file.Path);
//if (paths.ContainsKey(file))
// return paths[file];

path = Path.Combine(path, file.Path);
//path = Path.Combine(path, file.Path);

if (!Directory.Exists(Path.GetDirectoryName(path)) && !string.IsNullOrEmpty(Path.GetDirectoryName(path)))
Directory.CreateDirectory(Path.GetDirectoryName(path));
//if (!Directory.Exists(Path.GetDirectoryName(path)) && !string.IsNullOrEmpty(Path.GetDirectoryName(path)))
// Directory.CreateDirectory(Path.GetDirectoryName(path));

paths[file] = path;
//paths[file] = path;

return path;
//return path;
}

internal TorrentFileStream GetStream(string path, TorrentFile file, FileAccess access)
Expand Down

0 comments on commit cbff540

Please sign in to comment.