mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-04 10:54:35 +00:00
Merge pull request #5169 from glassez/tmpname
Use unique temp directories. Closes #5154.
This commit is contained in:
commit
0a81152267
@ -68,7 +68,6 @@ bool InfoHash::isValid() const
|
|||||||
return m_valid;
|
return m_valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InfoHash::operator libtorrent::sha1_hash() const
|
InfoHash::operator libtorrent::sha1_hash() const
|
||||||
{
|
{
|
||||||
return m_nativeHash;
|
return m_nativeHash;
|
||||||
|
@ -331,6 +331,13 @@ QString Session::tempPath() const
|
|||||||
return m_tempPath;
|
return m_tempPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString Session::torrentTempPath(const InfoHash &hash) const
|
||||||
|
{
|
||||||
|
return m_tempPath
|
||||||
|
+ static_cast<QString>(hash).left(7)
|
||||||
|
+ "/";
|
||||||
|
}
|
||||||
|
|
||||||
bool Session::isValidCategoryName(const QString &name)
|
bool Session::isValidCategoryName(const QString &name)
|
||||||
{
|
{
|
||||||
QRegExp re(R"(^([^\\\/]|[^\\\/]([^\\\/]|\/(?=[^\/]))*[^\\\/])$)");
|
QRegExp re(R"(^([^\\\/]|[^\\\/]([^\\\/]|\/(?=[^\/]))*[^\\\/])$)");
|
||||||
@ -1398,7 +1405,7 @@ bool Session::findIncompleteFiles(TorrentInfo &torrentInfo, QString &savePath) c
|
|||||||
|
|
||||||
bool found = findInDir(savePath, torrentInfo);
|
bool found = findInDir(savePath, torrentInfo);
|
||||||
if (!found && isTempPathEnabled()) {
|
if (!found && isTempPathEnabled()) {
|
||||||
savePath = m_tempPath;
|
savePath = torrentTempPath(torrentInfo.hash());
|
||||||
found = findInDir(savePath, torrentInfo);
|
found = findInDir(savePath, torrentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,6 +185,7 @@ namespace BitTorrent
|
|||||||
void setTempPath(QString path);
|
void setTempPath(QString path);
|
||||||
bool isTempPathEnabled() const;
|
bool isTempPathEnabled() const;
|
||||||
void setTempPathEnabled(bool enabled);
|
void setTempPathEnabled(bool enabled);
|
||||||
|
QString torrentTempPath(const InfoHash &hash) const;
|
||||||
|
|
||||||
static bool isValidCategoryName(const QString &name);
|
static bool isValidCategoryName(const QString &name);
|
||||||
// returns category itself and all top level categories
|
// returns category itself and all top level categories
|
||||||
|
@ -1392,7 +1392,7 @@ void TorrentHandle::handleStorageMovedAlert(libtorrent::storage_moved_alert *p)
|
|||||||
|
|
||||||
// Attempt to remove old folder if empty
|
// Attempt to remove old folder if empty
|
||||||
QDir oldSaveDir(Utils::Fs::fromNativePath(m_oldPath));
|
QDir oldSaveDir(Utils::Fs::fromNativePath(m_oldPath));
|
||||||
if ((oldSaveDir != QDir(m_session->defaultSavePath())) && (oldSaveDir != QDir(m_session->tempPath()))) {
|
if (oldSaveDir != QDir(m_session->defaultSavePath())) {
|
||||||
qDebug("Attempting to remove %s", qPrintable(m_oldPath));
|
qDebug("Attempting to remove %s", qPrintable(m_oldPath));
|
||||||
QDir().rmpath(m_oldPath);
|
QDir().rmpath(m_oldPath);
|
||||||
}
|
}
|
||||||
@ -1778,7 +1778,7 @@ void TorrentHandle::adjustActualSavePath_impl()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Moving all downloading torrents to temporary save path
|
// Moving all downloading torrents to temporary save path
|
||||||
path = m_session->tempPath();
|
path = m_session->torrentTempPath(hash());
|
||||||
qDebug() << "Moving torrent to its temp save path:" << path;
|
qDebug() << "Moving torrent to its temp save path:" << path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user