refactor: copy downloaded file according to torrent info

This commit is contained in:
Simon Ding
2025-01-31 19:34:18 +08:00
parent 1386626712
commit c01924ac3f
8 changed files with 92 additions and 35 deletions

View File

@@ -212,7 +212,7 @@ func (c *Client) moveCompletedTask(id int) (err1 error) {
}
//如果种子是路径,则会把路径展开,只移动文件,类似 move dir/* dir2/, 如果种子是文件,则会直接移动文件,类似 move file dir/
if err := stImpl.Copy(filepath.Join(c.db.GetDownloadDir(), torrentName), r.TargetDir); err != nil {
if err := stImpl.Copy(filepath.Join(c.db.GetDownloadDir(), torrentName), r.TargetDir, torrent.WalkFunc()); err != nil {
return errors.Wrap(err, "move file")
}
torrent.UploadProgresser = stImpl.UploadProgress