mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Added back removal of uneeded files on torrent deletion (but not do remove the ones that are complete)
This commit is contained in:
parent
01b9e5c754
commit
c1aec8671a
@ -667,15 +667,14 @@ void QBtSession::deleteTorrent(QString hash, bool delete_local_files) {
|
|||||||
if(h.has_metadata())
|
if(h.has_metadata())
|
||||||
uneeded_files = h.uneeded_files_path();
|
uneeded_files = h.uneeded_files_path();
|
||||||
s->remove_torrent(h);
|
s->remove_torrent(h);
|
||||||
// Remove unneeded files
|
// Remove unneeded and incomplete files
|
||||||
// XXX: Disabled this now that uneeded files are hidden
|
foreach(const QString &uneeded_file, uneeded_files) {
|
||||||
/*foreach(const QString &uneeded_file, uneeded_files) {
|
|
||||||
qDebug("Removing uneeded file: %s", qPrintable(uneeded_file));
|
qDebug("Removing uneeded file: %s", qPrintable(uneeded_file));
|
||||||
misc::safeRemove(uneeded_file);
|
misc::safeRemove(uneeded_file);
|
||||||
const QString parent_folder = misc::branchPath(uneeded_file);
|
const QString parent_folder = misc::branchPath(uneeded_file);
|
||||||
qDebug("Attempt to remove parent folder (if empty): %s", qPrintable(parent_folder));
|
qDebug("Attempt to remove parent folder (if empty): %s", qPrintable(parent_folder));
|
||||||
QDir().rmpath(parent_folder);
|
QDir().rmpath(parent_folder);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
// Remove it from torrent backup directory
|
// Remove it from torrent backup directory
|
||||||
QDir torrentBackup(misc::BTBackupLocation());
|
QDir torrentBackup(misc::BTBackupLocation());
|
||||||
|
@ -325,10 +325,12 @@ QStringList QTorrentHandle::uneeded_files_path() const {
|
|||||||
QDir saveDir(save_path());
|
QDir saveDir(save_path());
|
||||||
QStringList res;
|
QStringList res;
|
||||||
std::vector<int> fp = torrent_handle::file_priorities();
|
std::vector<int> fp = torrent_handle::file_priorities();
|
||||||
|
vector<float> progress;
|
||||||
|
torrent_handle::file_progress(progress);
|
||||||
torrent_info::file_iterator fi = torrent_handle::get_torrent_info().begin_files();
|
torrent_info::file_iterator fi = torrent_handle::get_torrent_info().begin_files();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while(fi != torrent_handle::get_torrent_info().end_files()) {
|
while(fi != torrent_handle::get_torrent_info().end_files()) {
|
||||||
if(fp[i] == 0)
|
if(fp[i] == 0 && progress[i] < 1.)
|
||||||
res << QDir::cleanPath(saveDir.absoluteFilePath(filepath(*fi)));
|
res << QDir::cleanPath(saveDir.absoluteFilePath(filepath(*fi)));
|
||||||
fi++;
|
fi++;
|
||||||
++i;
|
++i;
|
||||||
|
Loading…
Reference in New Issue
Block a user