More reliable folder scanning

This commit is contained in:
Christophe Dumez 2010-11-09 19:10:42 +00:00
parent ea1a54c5f1
commit 9c9944715a
3 changed files with 89 additions and 13 deletions

View file

@ -748,3 +748,14 @@ quint64 misc::computePathSize(QString path)
}
return size;
}
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;
}