mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 06:57:24 -06:00
More reliable folder scanning
This commit is contained in:
11
src/misc.cpp
11
src/misc.cpp
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user