mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 21:14:33 +00:00
Remove misc::removeEmptyFolder()
This commit is contained in:
parent
c25586b500
commit
b43e641d21
10
src/misc.cpp
10
src/misc.cpp
@ -921,16 +921,6 @@ QString misc::fileName(QString file_path)
|
|||||||
return file_path.mid(slash_index+1);
|
return file_path.mid(slash_index+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool misc::removeEmptyFolder(const QString &dirpath)
|
|
||||||
{
|
|
||||||
QDir savedir(dirpath);
|
|
||||||
const QString dirname = savedir.dirName();
|
|
||||||
if(savedir.exists() && savedir.cdUp()) {
|
|
||||||
return savedir.rmdir(dirname);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString misc::parseHtmlLinks(const QString &raw_text)
|
QString misc::parseHtmlLinks(const QString &raw_text)
|
||||||
{
|
{
|
||||||
QString result = raw_text;
|
QString result = raw_text;
|
||||||
|
@ -95,8 +95,6 @@ public:
|
|||||||
|
|
||||||
static QString parseHtmlLinks(const QString &raw_text);
|
static QString parseHtmlLinks(const QString &raw_text);
|
||||||
|
|
||||||
static bool removeEmptyFolder(const QString &dirpath);
|
|
||||||
|
|
||||||
static quint64 computePathSize(QString path);
|
static quint64 computePathSize(QString path);
|
||||||
|
|
||||||
static QString truncateRootFolder(boost::intrusive_ptr<libtorrent::torrent_info> t);
|
static QString truncateRootFolder(boost::intrusive_ptr<libtorrent::torrent_info> t);
|
||||||
|
@ -796,7 +796,7 @@ void QBtSession::deleteTorrent(const QString &hash, bool delete_local_files) {
|
|||||||
QFile::remove(uneeded_file);
|
QFile::remove(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));
|
||||||
misc::removeEmptyFolder(parent_folder);
|
QDir().rmdir(parent_folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remove it from torrent backup directory
|
// Remove it from torrent backup directory
|
||||||
@ -2357,7 +2357,7 @@ void QBtSession::readAlerts() {
|
|||||||
if(savePathsToRemove.contains(hash)) {
|
if(savePathsToRemove.contains(hash)) {
|
||||||
const QString dirpath = savePathsToRemove.take(hash);
|
const QString dirpath = savePathsToRemove.take(hash);
|
||||||
qDebug() << "Removing save path: " << dirpath << "...";
|
qDebug() << "Removing save path: " << dirpath << "...";
|
||||||
bool ok = misc::removeEmptyFolder(dirpath);
|
bool ok = QDir().rmdir(dirpath);
|
||||||
Q_UNUSED(ok);
|
Q_UNUSED(ok);
|
||||||
qDebug() << "Folder was removed: " << ok;
|
qDebug() << "Folder was removed: " << ok;
|
||||||
}
|
}
|
||||||
@ -2366,7 +2366,7 @@ void QBtSession::readAlerts() {
|
|||||||
qDebug() << "hash is empty, use fallback to remove save path";
|
qDebug() << "hash is empty, use fallback to remove save path";
|
||||||
foreach(const QString& key, savePathsToRemove.keys()) {
|
foreach(const QString& key, savePathsToRemove.keys()) {
|
||||||
// Attempt to delete
|
// Attempt to delete
|
||||||
if(misc::removeEmptyFolder(savePathsToRemove[key])) {
|
if(QDir().rmdir(savePathsToRemove[key])) {
|
||||||
savePathsToRemove.remove(key);
|
savePathsToRemove.remove(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user