From 650988c7acc5566fc4ec2cc57a8444f619cb061c Mon Sep 17 00:00:00 2001 From: Sucukdeluxe Date: Thu, 5 Mar 2026 16:27:29 +0100 Subject: [PATCH] Cleanup: remove leftover empty package folders after extract --- README.md | 6 ++++++ src/main/download-manager.ts | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9dde474..7933c74 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,12 @@ The app stores runtime files in Electron's `userData` directory, including: Release history is available on [git.24-music.de Releases](https://git.24-music.de/Administrator/real-debrid-downloader/releases). +### v1.6.61 (2026-03-05) + +- Fixed leftover empty package folders in `Downloader Unfertig` after successful extraction. +- Resume marker files (`.rd_extract_progress*.json`) are now treated as ignorable for empty-folder cleanup. +- Deferred post-processing now clears resume markers before running empty-directory removal. + ### v1.6.60 (2026-03-05) - Added package-scoped password cache for extraction: once the first archive in a package is solved, following archives in the same package reuse that password first. diff --git a/src/main/download-manager.ts b/src/main/download-manager.ts index 1e3f392..0407d3d 100644 --- a/src/main/download-manager.ts +++ b/src/main/download-manager.ts @@ -334,9 +334,11 @@ const EMPTY_DIR_IGNORED_FILE_NAMES = new Set([ "desktop.ini", ".ds_store" ]); +const EMPTY_DIR_IGNORED_FILE_RE = /^\.rd_extract_progress(?:_[^.\\/]+)?\.json$/i; function isIgnorableEmptyDirFileName(fileName: string): boolean { - return EMPTY_DIR_IGNORED_FILE_NAMES.has(String(fileName || "").trim().toLowerCase()); + const normalized = String(fileName || "").trim().toLowerCase(); + return EMPTY_DIR_IGNORED_FILE_NAMES.has(normalized) || EMPTY_DIR_IGNORED_FILE_RE.test(normalized); } function toWindowsLongPathIfNeeded(filePath: string): string { @@ -7121,6 +7123,13 @@ export class DownloadManager extends EventEmitter { } } + // ── Resume state cleanup ── + if (extractedCount > 0 && failed === 0) { + await clearExtractResumeState(pkg.outputDir, packageId); + // Backward compatibility: older versions used .rd_extract_progress.json without package suffix. + await clearExtractResumeState(pkg.outputDir); + } + // ── Empty directory tree removal ── if (extractedCount > 0 && failed === 0 && this.settings.cleanupMode === "delete") { if (!(await hasAnyFilesRecursive(pkg.outputDir))) { @@ -7131,11 +7140,6 @@ export class DownloadManager extends EventEmitter { } } - // ── Resume state cleanup ── - if (extractedCount > 0 && failed === 0) { - await clearExtractResumeState(pkg.outputDir, packageId); - } - // ── MKV collection ── if (success > 0 && (pkg.status === "completed" || pkg.status === "failed")) { pkg.postProcessLabel = "Verschiebe MKVs...";