mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-29 05:48:47 +03:00
- Make sure that scan directory is not qBittorrent backup folder to avoid torrent deletion
This commit is contained in:
parent
7fc0b02259
commit
66590bfa4a
1 changed files with 6 additions and 0 deletions
|
@ -984,6 +984,12 @@ void bittorrent::scanDirectory(QString scan_dir) {
|
||||||
FSMutex->lock();
|
FSMutex->lock();
|
||||||
qDebug("Scanning directory: %s", scan_dir.toLocal8Bit().data());
|
qDebug("Scanning directory: %s", scan_dir.toLocal8Bit().data());
|
||||||
QDir dir(scan_dir);
|
QDir dir(scan_dir);
|
||||||
|
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||||
|
// Check that scan dir is not BT_backup (silly but who knows...)
|
||||||
|
if(dir == torrentBackup) {
|
||||||
|
std::cerr << "Scan directory cannot be qBittorrent backup folder!" << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
QStringList filters;
|
QStringList filters;
|
||||||
filters << "*.torrent";
|
filters << "*.torrent";
|
||||||
QStringList files = dir.entryList(filters, QDir::Files, QDir::Unsorted);
|
QStringList files = dir.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||||
|
|
Loading…
Reference in a new issue