mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-15 17:53:08 -07:00
- Improved files deletion in BT_backup (no more hard-coded extensions that are annoying when adding new ones)
- Improved directory scanning for torrents using a "*.torrent" filter
This commit is contained in:
parent
7b9da8d941
commit
e66af5b271
2 changed files with 14 additions and 15 deletions
|
@ -163,16 +163,13 @@ void bittorrent::deleteTorrent(QString hash, bool permanent){
|
|||
s->remove_torrent(h);
|
||||
// Remove it from torrent backup directory
|
||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||
torrentBackup.remove(hash+".torrent");
|
||||
torrentBackup.remove(hash+".fastresume");
|
||||
torrentBackup.remove(hash+".paused");
|
||||
torrentBackup.remove(hash+".incremental");
|
||||
torrentBackup.remove(hash+".priorities");
|
||||
torrentBackup.remove(hash+".savepath");
|
||||
torrentBackup.remove(hash+".trackers");
|
||||
torrentBackup.remove(hash+".speedLimits");
|
||||
torrentBackup.remove(hash+".ratio");
|
||||
torrentBackup.remove(hash+".urlseeds");
|
||||
QStringList filters;
|
||||
filters << hash+".*";
|
||||
QStringList files = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||
QString file;
|
||||
foreach(file, files){
|
||||
torrentBackup.remove(file);
|
||||
}
|
||||
// Remove it from ETAs hash tables
|
||||
ETAstats.remove(hash);
|
||||
ETAs.remove(hash);
|
||||
|
@ -714,13 +711,13 @@ void bittorrent::scanDirectory(){
|
|||
if(!scan_dir.isNull()){
|
||||
QStringList to_add;
|
||||
QDir dir(scan_dir);
|
||||
QStringList files = dir.entryList(QDir::Files, QDir::Unsorted);
|
||||
QStringList filters;
|
||||
filters << "*.torrent";
|
||||
QStringList files = dir.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||
foreach(file, files){
|
||||
QString fullPath = dir.path()+QDir::separator()+file;
|
||||
if(fullPath.endsWith(".torrent")){
|
||||
QFile::rename(fullPath, fullPath+QString(".old"));
|
||||
to_add << fullPath+QString(".old");
|
||||
}
|
||||
QFile::rename(fullPath, fullPath+QString(".old"));
|
||||
to_add << fullPath+QString(".old");
|
||||
}
|
||||
emit scanDirFoundTorrents(to_add);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue