1
0
Fork 0
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:
Cœur 2023-02-28 22:51:11 +08:00 committed by GitHub
parent 1a276fb145
commit 63653b4831
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 8 deletions

View file

@ -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()
{

View file

@ -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();