mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 08:16:16 -07:00
More reliable folder scanning
This commit is contained in:
parent
ea1a54c5f1
commit
9c9944715a
3 changed files with 89 additions and 13 deletions
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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue