From a2792efa72e3d1c1f7d7623157a1fe5f25d0dd0c Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 26 Sep 2009 09:06:17 +0000 Subject: [PATCH] - Make sure torrents are complete before auto downloader picks them up --- src/bittorrent.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 94efc38c7..37a1e9acd 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -987,11 +987,12 @@ void bittorrent::scanDirectory(QString scan_dir) { foreach(const QString &file, files) { QString fullPath = dir.path()+QDir::separator()+file; QFile torrent(fullPath); - if(torrent.size() != 0) { - qDebug("Adding for scan_dir: %s", fullPath.toLocal8Bit().data()); + qDebug("Adding for scan_dir: %s", fullPath.toLocal8Bit().data()); + try { + torrent_info t(fullPath.toLocal8Bit().data()); addTorrent(fullPath, true); - } else { - qDebug("Ignoring empty file: %s", fullPath.toLocal8Bit().data()); + } catch(std::exception&) { + qDebug("Ignoring incomplete torrent file: %s", fullPath.toLocal8Bit().data()); } } FSMutex->unlock();