Cleanup: remove leftover empty package folders after extract

This commit is contained in:
Sucukdeluxe 2026-03-05 16:27:29 +01:00
parent 49e62c1f83
commit 650988c7ac
2 changed files with 16 additions and 6 deletions

View File

@ -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). 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) ### 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. - 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.

View File

@ -334,9 +334,11 @@ const EMPTY_DIR_IGNORED_FILE_NAMES = new Set([
"desktop.ini", "desktop.ini",
".ds_store" ".ds_store"
]); ]);
const EMPTY_DIR_IGNORED_FILE_RE = /^\.rd_extract_progress(?:_[^.\\/]+)?\.json$/i;
function isIgnorableEmptyDirFileName(fileName: string): boolean { 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 { 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 ── // ── Empty directory tree removal ──
if (extractedCount > 0 && failed === 0 && this.settings.cleanupMode === "delete") { if (extractedCount > 0 && failed === 0 && this.settings.cleanupMode === "delete") {
if (!(await hasAnyFilesRecursive(pkg.outputDir))) { 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 ── // ── MKV collection ──
if (success > 0 && (pkg.status === "completed" || pkg.status === "failed")) { if (success > 0 && (pkg.status === "completed" || pkg.status === "failed")) {
pkg.postProcessLabel = "Verschiebe MKVs..."; pkg.postProcessLabel = "Verschiebe MKVs...";