Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.
Swift cache-cleanercleanerclideveloper-toolsdisk-cleanupdisk-spaceduplicate-finderhomebrewliquid-glassmac-cleanermacosmacos-appmacos-golden-gatemacos-tahoemacos-tweaksswiftswiftuiterminal-themesuninstalluninstaller
Installers lists downloads a browser never finished
Țugui Dragoșdf005cbabd2d
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex dc5060eb..c7e3af34 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -28460,6 +28460,112 @@}}},+ "Downloads a browser never finished, still under the name it gives a file until the download ends: .crdownload for Chrome and the browsers built on Chromium, .part for Firefox." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Stahování, která prohlížeč nikdy nedokončil a která stále nesou název, jaký souboru dává do konce stahování: .crdownload pro Chrome a prohlížeče založené na projektu Chromium, .part pro Firefox."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Downloads, die ein Browser nie abgeschlossen hat, noch unter dem Namen, den er einer Datei bis zum Ende des Downloads gibt: .crdownload für Chrome und die auf Chromium basierenden Browser, .part für Firefox."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Descargas que un navegador nunca terminó, aún con el nombre que da a un archivo hasta que acaba la descarga: .crdownload en Chrome y en los navegadores basados en Chromium, .part en Firefox."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Les téléchargements qu’un navigateur n’a jamais terminés, encore sous le nom qu’il donne à un fichier jusqu’à la fin du téléchargement : .crdownload pour Chrome et les navigateurs basés sur Chromium, .part pour Firefox."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Download che un browser non ha mai completato, ancora con il nome che dà al file finché il download non termina: .crdownload per Chrome e i browser basati su Chromium, .part per Firefox."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "ブラウザが完了しなかったダウンロードです。ダウンロードが終わるまでブラウザがファイルに付ける名前のまま残っています。Chromeと、Chromiumをベースにしたブラウザでは.crdownload、Firefoxでは.partです。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "브라우저가 완료하지 못한 다운로드로, 다운로드가 끝날 때까지 브라우저가 파일에 붙이는 이름이 아직 그대로 남아 있습니다. Chrome 및 Chromium 기반 브라우저는 .crdownload, Firefox는 .part입니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Downloads die een browser nooit heeft voltooid, nog onder de naam die de browser een bestand geeft tot de download klaar is: .crdownload voor Chrome en de browsers die op Chromium zijn gebouwd, .part voor Firefox."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Pliki, których przeglądarka nigdy nie skończyła pobierać, wciąż pod nazwą, jaką nadaje plikowi do końca pobierania: .crdownload w Chrome i przeglądarkach opartych na Chromium, .part w przeglądarce Firefox."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Downloads que um navegador nunca concluiu, ainda com o nome que ele dá a um arquivo até o fim do download: .crdownload no Chrome e nos navegadores baseados no Chromium, .part no Firefox."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Descărcări pe care un browser nu le‑a terminat, încă sub numele pe care îl dă unui fișier până la încheierea descărcării: .crdownload pentru Chrome și browserele bazate pe Chromium, .part pentru Firefox."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Загрузки, которые браузер так и не завершил. У таких файлов все еще временное имя, которое браузер дает файлу до окончания загрузки: .crdownload в Chrome и браузерах на основе Chromium, .part в Firefox."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Hämtningar som en webbläsare aldrig slutförde, fortfarande under det namn den ger en fil tills hämtningen är klar: .crdownload för Chrome och webbläsarna som bygger på Chromium, .part för Firefox."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Bir tarayıcının hiç tamamlamadığı indirmeler; indirme bitene kadar dosyaya verdiği adı hâlâ taşırlar: Chrome ve Chromium tabanlı tarayıcılar için .crdownload, Firefox için .part."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Викачування, яких браузер так і не завершив. Файл досі має назву, яку браузер дає йому, доки викачування не закінчиться: .crdownload у Chrome і браузерах на основі Chromium, .part у Firefox."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "浏览器未完成的下载,仍使用浏览器在下载结束前为文件指定的名称:Chrome及基于Chromium的浏览器为.crdownload,Firefox为.part。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "瀏覽器未完成的下載項目,在下載結束前仍使用瀏覽器為檔案取的名稱:Chrome及以Chromium為基礎的瀏覽器使用.crdownload,Firefox使用.part。"+ }+ }+ }+ },"Downloads kept so you can install them again" : {"localizations" : {"cs" : {@@ -72931,6 +73037,112 @@}}},+ "Not selected: this changed in the last day, so it may still be downloading." : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nevybráno: tento soubor se za poslední den změnil, takže se možná ještě stahuje."+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nicht ausgewählt: Dieses Objekt wurde innerhalb des letzten Tages geändert und wird daher möglicherweise noch geladen."+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Sin seleccionar: ha cambiado en el último día, así que puede que aún se esté descargando."+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Non sélectionné : ce fichier a changé ces dernières 24 heures et est peut-être encore en cours de téléchargement."+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Non selezionato: è cambiato nell’ultimo giorno, quindi il download potrebbe essere ancora in corso."+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未選択: 過去1日以内に変更されたため、まだダウンロード中の可能性があります。"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "선택되지 않음: 이 파일은 지난 하루 사이에 변경되었으므로, 아직 다운로드하는 중일 수 있습니다."+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Niet geselecteerd: dit is in de afgelopen dag gewijzigd, dus het wordt misschien nog gedownload."+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nie zaznaczono: ten plik zmienił się w ciągu ostatniej doby, więc może być jeszcze pobierany."+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Não selecionado: este item foi alterado no último dia e pode ainda estar sendo baixado."+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Neselectat: acest fișier s‑a modificat în ultima zi, așa că poate fi încă în curs de descărcare."+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не выбрано: этот файл изменился за последние сутки, поэтому, возможно, еще загружается."+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Inte markerad: den här filen har ändrats under det senaste dygnet, så den kanske fortfarande hämtas."+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Seçilmedi: bu dosya son bir gün içinde değişti, bu nedenle hâlâ indiriliyor olabilir."+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Не вибрано: цей файл змінився за останню добу, тож, можливо, він ще викачується."+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未选择:此文件在过去一天内发生了更改,因此可能仍在下载。"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未選取:此項目在過去一天內有變更,因此可能仍在下載。"+ }+ }+ }+ },"Not selected: this folder took too long to measure, so Peel doesn’t know how big it is or what is inside." : {"localizations" : {"cs" : {@@ -129900,6 +130112,112 @@}}},+ "Unfinished Downloads" : {+ "localizations" : {+ "cs" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Nedokončená stahování"+ }+ },+ "de" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Unvollständige Downloads"+ }+ },+ "es" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Descargas sin terminar"+ }+ },+ "fr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Téléchargements inachevés"+ }+ },+ "it" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Download non completati"+ }+ },+ "ja" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未完了のダウンロード"+ }+ },+ "ko" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "완료되지 않은 다운로드"+ }+ },+ "nl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Onvoltooide downloads"+ }+ },+ "pl" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Niedokończone pobierania"+ }+ },+ "pt" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Downloads Incompletos"+ }+ },+ "ro" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Descărcări neterminate"+ }+ },+ "ru" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Незавершенные загрузки"+ }+ },+ "sv" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Ofullständiga hämtningar"+ }+ },+ "tr" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Tamamlanmamış İndirmeler"+ }+ },+ "uk" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "Незавершені викачування"+ }+ },+ "zh-Hans" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未完成的下载"+ }+ },+ "zh-Hant" : {+ "stringUnit" : {+ "state" : "translated",+ "value" : "未完成的下載項目"+ }+ }+ }+ },"Uninstall" : {"localizations" : {"cs" : {diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swiftindex 661d5a6c..7aff7b26 100644--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift@@ -276,6 +276,7 @@ extension HoldBack {case .crashReport: "a crash report, which the app's developer may still ask for"case .inTheCloud: "in iCloud Drive, so moving it removes it from every device"case .openInAProgram: "open in a program right now, which may still be downloading it"+ case .changedRecently: "changed in the last day, so it may still be downloading"}}}diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swiftindex 40b8b501..10a4b535 100644--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift@@ -69,6 +69,8 @@ public enum HoldBack: String, Sendable, Hashable {case inTheCloud/// A file a program has open right now, which may still be downloading it.case openInAProgram+ /// A download that changed within the last day, which may still be going.+ case changedRecently/// True when the item cannot be selected at all, rather than only left unselected.public var cannotBeMoved: Bool {diff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swiftindex fd3251d0..c81443b3 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift@@ -8,6 +8,8 @@ public struct InstallerItem: Sendable, Hashable, Identifiable {case macOSInstallercase firmwarecase deviceBackup+ /// A download a browser never finished, still under the name it writes to until the end.+ case incompleteDownload}public let url: URL@@ -62,6 +64,12 @@ public enum Installers {/// anything: `installerInside(zip:)` decides about each one.static let installerExtensions: Set<String> = ["dmg", "iso", "pkg", "mpkg", "xip"]static let firmwareExtensions: Set<String> = ["ipsw"]+ /// What a browser adds to a download's name until it ends: Chromium's `.crdownload`+ /// (`chrome/browser/download/download_target_determiner.cc`) and Firefox's `.part`+ /// (`netwerk/base/nsIBackgroundFileSaver.idl`).+ static let incompleteDownloadExtensions: Set<String> = ["crdownload", "part"]+ /// A download that changed within this time may still be going, whatever holds it open.+ static let stillDownloading: TimeInterval = 24 * 60 * 60@concurrentpublic static func scan(@@ -105,11 +113,16 @@ public enum Installers {let suffix = url.pathExtension.lowercased()let isInstaller = installerExtensions.contains(suffix)let isArchive = suffix == "zip"- guard isInstaller || isArchive || firmwareExtensions.contains(suffix), !exclusions.excludes(url), !Task.isCancelled else { continue }+ let isIncomplete = incompleteDownloadExtensions.contains(suffix)+ guard isInstaller || isArchive || isIncomplete || firmwareExtensions.contains(suffix),+ !exclusions.excludes(url), !Task.isCancelled+ else { continue }let (size, seen) = await measured(url, by: measure)guard isWorthARow(size, minimumSize) else { continue }let heldBack = heldBack(url, seen: seen, in: folder, isInTheCloud: isInTheCloud, openFiles: openFiles)- if isArchive {+ if isIncomplete {+ items.append(incompleteDownload(at: url, size: size, heldBack: heldBack))+ } else if isArchive {guard let inside = installerInside(zip: url) else { continue }items.append(appInstaller(at: url, size: size, heldBack: heldBack, installedApps: installedApps, named: inside)@@ -353,6 +366,25 @@ public enum Installers {return items}+ /// Makes the item for an unfinished download. One that changed within `stillDownloading` may still be going, so+ /// it is left for the person to choose.+ static func incompleteDownload(at url: URL, size: Int64?, heldBack: HoldBack?) -> InstallerItem {+ let changed = (try? url.resourceValues(forKeys: [.contentModificationDateKey]))?.contentModificationDate+ let isRecent = changed.map { Date.now.timeIntervalSince($0) < stillDownloading } ?? true+ return InstallerItem(+ url: url,+ kind: .incompleteDownload,+ name: url.lastPathComponent,+ size: size,+ date: changed,+ installedApp: nil,+ isReadOnly: false,+ notes: [],+ requiresPrivileges: FileAccess.requiresPrivilegesToRemove(url),+ heldBack: heldBack ?? (isRecent ? .changedRecently : nil)+ )+ }+static func firmware(at url: URL, size: Int64?, heldBack: HoldBack?) -> InstallerItem {InstallerItem(url: url,diff --git a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swiftindex 7ceac9ec..fb508686 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift@@ -247,6 +247,31 @@ struct InstallersTests {#expect(items["Install macOS Tahoe"]?.heldBack == .some(nil))}+ /// A browser writes a download under a name of its own until it ends: `.crdownload` for Chromium, `.part` for+ /// Firefox. One left behind is an unfinished download; one that changed in the last day may still be going.+ @Test func findsUnfinishedDownloadsAndLeavesARecentOneToChoose() async throws {+ let directory = try TemporaryDirectory()+ let abandoned = try directory.file("Downloads/Video.mp4.crdownload", bytes: 400_000)+ try directory.file("Downloads/Archive.zip.part", bytes: 400_000)+ try directory.file("Downloads/notes.txt", bytes: 400_000)+ try directory.directory("Applications")+ let old = Date.now.addingTimeInterval(-3 * 24 * 60 * 60)+ try FileManager.default.setAttributes(+ [.modificationDate: old], ofItemAtPath: abandoned.path(percentEncoded: false)+ )++ let scan = await Installers.scan(+ installedApps: [], home: directory.url, root: directory.url, exclusions: .none, minimumSize: 100_000,+ measure: LeftoverScanner.walk, openFiles: OpenFiles(excluding: nil)+ )++ let items = Dictionary(uniqueKeysWithValues: scan.items.map { ($0.name, $0) })+ #expect(Set(items.keys) == ["Video.mp4.crdownload", "Archive.zip.part"])+ #expect(items.values.allSatisfy { $0.kind == .incompleteDownload })+ #expect(items["Video.mp4.crdownload"]?.heldBack == .some(nil))+ #expect(items["Archive.zip.part"]?.heldBack == .changedRecently)+ }+@Test func aDownloadAProgramStillHasOpenIsLeftForThePersonToChoose() async throws {let directory = try TemporaryDirectory()let downloading = try directory.file("Downloads/Tool-1.dmg", bytes: 400_000)diff --git a/Peel/Model/InstallerLibrary.swift b/Peel/Model/InstallerLibrary.swiftindex 39110dfa..8e7ad96c 100644--- a/Peel/Model/InstallerLibrary.swift+++ b/Peel/Model/InstallerLibrary.swift@@ -79,6 +79,7 @@ extension InstallerItem.Kind {case .macOSInstaller: "macOS Installers"case .firmware: "Device Firmware"case .deviceBackup: "iPhone and iPad Backups"+ case .incompleteDownload: "Unfinished Downloads"}}@@ -88,6 +89,7 @@ extension InstallerItem.Kind {case .macOSInstaller: "A full copy of macOS, ready to install. Apple offers the newest release again to any Mac that can run it."case .firmware: "Firmware for restoring Apple devices, such as an iPhone, an iPad, or a Mac. It is downloaded again when a device needs it."case .deviceBackup: "Almost all of a device’s data and settings, backed up to this Mac. Peel shows what is here and leaves the rest to Finder."+ case .incompleteDownload: "Downloads a browser never finished, still under the name it gives a file until the download ends: .crdownload for Chrome and the browsers built on Chromium, .part for Firefox."}}@@ -97,6 +99,7 @@ extension InstallerItem.Kind {case .macOSInstaller: "apple.logo"case .firmware: "iphone.gen3"case .deviceBackup: "externaldrive"+ case .incompleteDownload: "arrow.down.circle.dotted"}}}diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swiftindex f5525294..423f1135 100644--- a/Peel/Views/Presentation.swift+++ b/Peel/Views/Presentation.swift@@ -214,6 +214,8 @@ extension HoldBack {"Not selected: this is in iCloud Drive, so moving it to the Trash removes it from iCloud and from your other devices."case .openInAProgram:"Not selected: a program has this open right now, and may still be downloading it."+ case .changedRecently:+ "Not selected: this changed in the last day, so it may still be downloading."}}}diff --git a/README.md b/README.mdindex 03e69589..3f3fdfa5 100644--- a/README.md+++ b/README.md@@ -117,8 +117,8 @@ Peel is free and open source, and it speaks English and 17 other languages.neither are installed packages (a Python environment, `vendor`, Terraform's `.terraform`) or a folder like `target`whose name says nothing on its own.- **Duplicates:** files and whole folders with identical contents, compared with SHA-256. One copy is always kept.-- **Installers and Backups:** installers of apps you already have, macOS installers, device firmware, and what your- iPhone backups hold. Nothing is selected for you.+- **Installers and Backups:** installers of apps you already have, macOS installers, device firmware, downloads a+ browser never finished, and what your iPhone backups hold. Nothing is selected for you.- **iCloud Drive:** files already safe in iCloud that are also downloaded to this Mac. Remove Downloads, as inFinder, takes away only the copy on this Mac: each file stays in iCloud and downloads again when you open it.- **Space:** what's taking up room, and which app it belongs to. The caches and logs apps keep for every account,