|
|
@ -1788,12 +1788,18 @@ bool Session::deleteTorrent(const InfoHash &hash, const DeleteOption deleteOptio |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Remove it from torrent resume directory
|
|
|
|
// Remove it from torrent resume directory
|
|
|
|
const QDir resumeDataDir(m_resumeFolderPath); |
|
|
|
const QString resumedataFile = QString::fromLatin1("%1.fastresume").arg(torrent->hash()); |
|
|
|
QStringList filters; |
|
|
|
const QString metadataFile = QString::fromLatin1("%1.torrent").arg(torrent->hash()); |
|
|
|
filters << QString::fromLatin1("%1.*").arg(torrent->hash()); |
|
|
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) |
|
|
|
const QStringList files = resumeDataDir.entryList(filters, QDir::Files, QDir::Unsorted); |
|
|
|
QMetaObject::invokeMethod(m_resumeDataSavingManager, [this, resumedataFile, metadataFile]() |
|
|
|
for (const QString &file : files) |
|
|
|
{ |
|
|
|
Utils::Fs::forceRemove(resumeDataDir.absoluteFilePath(file)); |
|
|
|
m_resumeDataSavingManager->remove(resumedataFile); |
|
|
|
|
|
|
|
m_resumeDataSavingManager->remove(metadataFile); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
QMetaObject::invokeMethod(m_resumeDataSavingManager, "remove", Q_ARG(QString, resumedataFile)); |
|
|
|
|
|
|
|
QMetaObject::invokeMethod(m_resumeDataSavingManager, "remove", Q_ARG(QString, metadataFile)); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
delete torrent; |
|
|
|
delete torrent; |
|
|
|
return true; |
|
|
|
return true; |
|
|
|