mirror of
https://github.com/transmission/transmission
synced 2024-12-23 08:13:27 +00:00
fix: recheckCompleteness on setDownloadDir (#5060)
This commit is contained in:
parent
1a276fb145
commit
63653b4831
2 changed files with 24 additions and 8 deletions
|
@ -1392,7 +1392,7 @@ void tr_torrentSetDownloadDir(tr_torrent* tor, char const* path)
|
|||
|
||||
if (tor->download_dir != path)
|
||||
{
|
||||
tor->setDownloadDir(path);
|
||||
tor->setDownloadDir(path, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2435,6 +2435,28 @@ size_t tr_torrentFindFileToBuf(tr_torrent const* tor, tr_file_index_t file_num,
|
|||
return tr_strvToBuf(tr_torrentFindFile(tor, file_num), buf, buflen);
|
||||
}
|
||||
|
||||
void tr_torrent::setDownloadDir(std::string_view path, bool isNewTorrent)
|
||||
{
|
||||
download_dir = path;
|
||||
markEdited();
|
||||
setDirty();
|
||||
refreshCurrentDir();
|
||||
|
||||
if (isNewTorrent)
|
||||
{
|
||||
if (session->shouldFullyVerifyAddedTorrents() || !torrent_init_helpers::isNewTorrentASeed(this))
|
||||
{
|
||||
tr_torrentVerify(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
completion.setHasAll();
|
||||
doneDate = addedDate;
|
||||
recheckCompleteness();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// decide whether we should be looking for files in downloadDir or incompleteDir
|
||||
void tr_torrent::refreshCurrentDir()
|
||||
{
|
||||
|
|
|
@ -582,13 +582,7 @@ public:
|
|||
this->error_string = errmsg;
|
||||
}
|
||||
|
||||
void setDownloadDir(std::string_view path)
|
||||
{
|
||||
download_dir = path;
|
||||
markEdited();
|
||||
setDirty();
|
||||
refreshCurrentDir();
|
||||
}
|
||||
void setDownloadDir(std::string_view path, bool isNewTorrent = false);
|
||||
|
||||
void refreshCurrentDir();
|
||||
|
||||
|
|
Loading…
Reference in a new issue