mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07:00
- Remove old folders after renaming
This commit is contained in:
parent
28ecb2fe1d
commit
7d66c07cef
3 changed files with 181 additions and 159 deletions
13
src/misc.h
13
src/misc.h
|
@ -269,6 +269,19 @@ public:
|
|||
list.insert(i, value);
|
||||
}
|
||||
|
||||
static bool removeEmptyTree(QString path) {
|
||||
QDir dir(path);
|
||||
foreach(QString child, dir.entryList(QDir::AllDirs)) {
|
||||
if(child == "." || child == "..") continue;
|
||||
return removeEmptyTree(dir.absoluteFilePath(child));
|
||||
}
|
||||
QString dir_name = dir.dirName();
|
||||
if(dir.cdUp()) {
|
||||
return dir.rmdir(dir_name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static QString magnetUriToHash(QString magnet_uri) {
|
||||
QString hash = "";
|
||||
QRegExp regHex("urn:btih:([0-9A-Za-z]+)");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue