mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-12 08:16:16 -07:00
Remove empty folders on torrent soft deletion
Code clean up
This commit is contained in:
parent
20d90e0e0c
commit
cc4e1c5bbe
4 changed files with 16 additions and 19 deletions
19
src/misc.cpp
19
src/misc.cpp
|
@ -557,19 +557,6 @@ bool misc::isPreviewable(QString extension){
|
|||
return false;
|
||||
}
|
||||
|
||||
bool misc::removeEmptyTree(QString path) {
|
||||
QDir dir(path);
|
||||
foreach(const QString &child, dir.entryList(QDir::AllDirs)) {
|
||||
if(child == "." || child == "..") continue;
|
||||
return removeEmptyTree(dir.absoluteFilePath(child));
|
||||
}
|
||||
const QString dir_name = dir.dirName();
|
||||
if(dir.cdUp()) {
|
||||
return dir.rmdir(dir_name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QString misc::bcLinkToMagnet(QString bc_link) {
|
||||
QByteArray raw_bc = bc_link.toUtf8();
|
||||
raw_bc = raw_bc.mid(8); // skip bc://bt/
|
||||
|
@ -759,3 +746,9 @@ bool misc::isValidTorrentFile(const QString &torrent_path) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
QString misc::branchPath(QString file_path)
|
||||
{
|
||||
file_path.replace("\\", "/");
|
||||
return file_path.left(file_path.lastIndexOf('/'));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue