More reliable folder scanning for torrents

This commit is contained in:
Christophe Dumez
2010-11-09 19:17:08 +00:00
parent ca835a105b
commit 8d6df1f15f
4 changed files with 90 additions and 13 deletions

View File

@@ -729,3 +729,14 @@ QList<bool> misc::boolListfromStringList(const QStringList &l) {
}
return ret;
}
bool misc::isValidTorrentFile(const QString &torrent_path) {
try {
boost::intrusive_ptr<libtorrent::torrent_info> t = new torrent_info(torrent_path.toUtf8().constData());
if(!t->is_valid() || t->num_files() == 0)
throw std::exception();
} catch(std::exception&) {
return false;
}
return true;
}