Don't leave an empty folder when deleting or moving torrents

Currently when you delete or move a torrent sometimes an empty folder will stay. This is because hidden files will stay which didn't got deleted.
The reason that it is not working is that QDir::Files is used which doesn't lists hidden files. Adding QDir::Hidden will make the code work as expected. At least on Windows and macOS QDir::Files doesn't lists hidden files. I can't test on linux.

PR #22983.
This commit is contained in:
Ryu481 2025-07-14 19:44:57 +02:00 committed by GitHub
commit ec9d541bbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -104,7 +104,7 @@ bool Utils::Fs::smartRemoveEmptyFolderTree(const Path &path)
if (!dir.isEmpty(QDir::Dirs | QDir::NoDotAndDotDot))
continue;
const QStringList tmpFileList = dir.entryList(QDir::Files);
const QStringList tmpFileList = dir.entryList(QDir::Files | QDir::Hidden);
// deleteFilesList contains unwanted files, usually created by the OS
// temp files on linux usually end with '~', e.g. `filename~`