From 8c88e8bba0c9eaf8f2582e51dce164e658b1ebcf Mon Sep 17 00:00:00 2001 From: Mike Gelfand Date: Thu, 6 Jul 2017 21:46:32 +0300 Subject: [PATCH] Change torrent location even if no data move is needed This helps when old and new location point to the same place but the actual path differs (i.e. one of the paths is a symlink). Fixes: #35 --- libtransmission/torrent.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index da62b8b7f..4f7e75cbe 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -3348,24 +3348,24 @@ static void setLocation(void* vdata) } } - if (!err) + if (!err && do_move) { /* blow away the leftover subdirectories in the old location */ - if (do_move) - { - tr_torrentDeleteLocalData(tor, tr_sys_path_remove); - } - - /* set the new location and reverify */ - tr_torrentSetDownloadDir(tor, location); + tr_torrentDeleteLocalData(tor, tr_sys_path_remove); } } - if (!err && do_move) + if (!err) { - tr_free(tor->incompleteDir); - tor->incompleteDir = NULL; - tor->currentDir = tor->downloadDir; + /* set the new location and reverify */ + tr_torrentSetDownloadDir(tor, location); + + if (do_move) + { + tr_free(tor->incompleteDir); + tor->incompleteDir = NULL; + tor->currentDir = tor->downloadDir; + } } if (data->setme_state != NULL) -- 2.40.0