Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Leave a part file no browser left to the person

Țugui Dragoșff57ab6d00c6
diff --git a/GUIDE.md b/GUIDE.md
index c248c207..19c61880 100644
--- a/GUIDE.md
+++ b/GUIDE.md
@@ -118,16 +118,17 @@ Space shows what fills your disk, area by area, and what each area is.
from your other devices too: beside a copy on this Mac it is marked Stays, and a group whose every copy syncs is
listed under Synced to Other Devices. A chosen folder Peel doesn't scan, such as a repository, is named with why,
in Scan Settings and with the result.
-- **Installers and Backups:** disk images and packages in Downloads, Desktop, Documents, Public, and Shared, and in
- the folders directly inside them, where installers are usually left, with archives there that hold an app or an
- installer. It also lists packages an app keeps in Application Support, macOS installers, device firmware,
- downloads a browser never finished, and updates apps downloaded and keep until they install them. Your iPhone and
- iPad backups are listed with their size once Peel has Full Disk Access, and never moved. Nothing is selected for
- you, and Select Recommended takes only what you can download again, such as an installed app's installer, any
- installer in Downloads, a macOS installer, or device firmware. It passes by an encrypted disk image, an installer
- elsewhere that is no installed app's, a package an app keeps for itself, a download that changed in the last day,
- an update whose app is open, and anything in Shared, open in a program, or syncing to your other devices. A disk
- image can also be one you made to keep files in, so look before you select it.
+- **Installers and Backups:** disk images and packages in Downloads, Desktop, Documents, Public, and Shared, and in the
+ folders directly inside them, where installers are usually left, with archives there that hold an app or an installer.
+ It also lists packages an app keeps in Application Support, macOS installers, device firmware, downloads never
+ finished, and updates apps downloaded and keep until they install them. Your iPhone and iPad backups are listed with
+ their size once Peel has Full Disk Access, and never moved. Nothing is selected for you, and Select Recommended takes
+ only what you can download again, such as an installed app's installer, any installer in Downloads, a macOS installer,
+ or device firmware. It passes by an encrypted disk image, an installer elsewhere that is no installed app's, a package
+ an app keeps for itself, a download that changed in the last day, a `.part` file no browser left, which a torrent
+ client or another program that resumes downloads may still finish, an update whose app is open, and anything in
+ Shared, open in a program, or syncing to your other devices. A disk image can also be one you made to keep files in,
+ so look before you select it.
- **iCloud Drive:** files already safe in iCloud that are also downloaded to this Mac, as Finder shows them: what is in
iCloud Drive and each app's documents, never an app's own data. Downloads are listed in the folders Finder shows
them in, named as Finder names them, the biggest first, and a folder's checkbox selects every file in it; a file
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 4a2e4e98..13d46c96 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -36729,214 +36729,214 @@
}
}
},
- "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, and .download for Safari." : {
+ "Downloads kept so you can install them again" : {
"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 a .download pro Safari."
+ "value" : "Stažené soubory uchované, abyste je mohli znovu nainstalovat"
}
},
"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 und .download für Safari."
+ "value" : "Downloads, die aufbewahrt werden, damit du sie erneut installieren kannst"
}
},
"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 y .download en Safari."
+ "value" : "Descargas que se conservan para que puedas volver a instalarlas"
}
},
"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 et .download pour Safari."
+ "value" : "Téléchargements conservés pour que vous puissiez les réinstaller"
}
},
"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 e .download per Safari."
+ "value" : "Download conservati, così puoi reinstallarli"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
- "value" : "ブラウザが完了しなかったダウンロードです。ダウンロードが終わるまでブラウザがファイルに付ける名前のまま残っています。Chromeと、Chromiumをベースにしたブラウザでは.crdownload、Firefoxでは.part、Safariでは.downloadです。"
+ "value" : "再インストールできるように保管されているダウンロード"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
- "value" : "브라우저가 완료하지 못한 다운로드로, 다운로드가 끝날 때까지 브라우저가 파일에 붙이는 이름이 아직 그대로 남아 있습니다. Chrome 및 Chromium 기반 브라우저는 .crdownload, Firefox는 .part, Safari는 .download입니다."
+ "value" : "다운로드 파일, 다시 설치할 수 있도록 보관됨"
}
},
"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 en .download voor Safari."
+ "value" : "Downloads, bewaard zodat je ze opnieuw kunt installeren"
}
},
"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 i .download w Safari."
+ "value" : "Pobrane pliki zachowane do ponownej instalacji"
}
},
"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 e .download no Safari."
+ "value" : "Downloads guardados para que você possa instalá-los de novo"
}
},
"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 și .download pentru Safari."
+ "value" : "Descărcări păstrate ca să le puteți instala din nou"
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Загрузки, которые браузер так и не завершил. У таких файлов все еще временное имя, которое браузер дает файлу до окончания загрузки: .crdownload в Chrome и браузерах на основе Chromium, .part в Firefox и .download в Safari."
+ "value" : "Загрузки, которые хранятся, чтобы Вы могли установить их снова"
}
},
"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 och .download för Safari."
+ "value" : "Hämtningar som sparas så att du kan installera dem igen"
}
},
"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 ve Safari için .download."
+ "value" : "Yeniden yükleyebilmeniz için saklanan indirmeler"
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Викачування, яких браузер так і не завершив. Файл досі має назву, яку браузер дає йому, доки викачування не закінчиться: .crdownload у Chrome і браузерах на основі Chromium, .part у Firefox і .download у Safari."
+ "value" : "Викачані файли, які зберігаються, щоб ви могли інсталювати їх знову"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "浏览器未完成的下载,仍使用浏览器在下载结束前为文件指定的名称:Chrome及基于Chromium的浏览器为.crdownload,Firefox为.part,Safari浏览器为.download。"
+ "value" : "下载文件,保留下来以便你重新安装"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
- "value" : "瀏覽器未完成的下載項目,在下載結束前仍使用瀏覽器為檔案取的名稱:Chrome及以Chromium為基礎的瀏覽器使用.crdownload,Firefox使用.part,Safari使用.download。"
+ "value" : "下載檔案,保留供你重新安裝"
}
}
}
},
- "Downloads kept so you can install them again" : {
+ "Downloads never finished, still under the name a file has until its download ends: .crdownload for Chrome and the browsers built on Chromium, .part for Firefox and programs such as torrent clients, and .download for Safari." : {
"localizations" : {
"cs" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Stažené soubory uchované, abyste je mohli znovu nainstalovat"
+ "value" : "Stahování, která se nikdy nedokončila a která stále nesou název, jaký soubor má do konce stahování: .crdownload pro Chrome a prohlížeče založené na projektu Chromium, .part pro Firefox a programy, jako jsou torrentoví klienti, a .download pro Safari."
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Downloads, die aufbewahrt werden, damit du sie erneut installieren kannst"
+ "value" : "Downloads, die nie abgeschlossen wurden, noch unter dem Namen, den eine Datei bis zum Ende ihres Downloads trägt: .crdownload für Chrome und die auf Chromium basierenden Browser, .part für Firefox und Programme wie Torrent-Clients sowie .download für Safari."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Descargas que se conservan para que puedas volver a instalarlas"
+ "value" : "Descargas que nunca terminaron, aún con el nombre que tiene un archivo hasta que acaba su descarga: .crdownload en Chrome y en los navegadores basados en Chromium, .part en Firefox y en programas como los clientes de torrent, y .download en Safari."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Téléchargements conservés pour que vous puissiez les réinstaller"
+ "value" : "Les téléchargements jamais terminés, encore sous le nom que porte un fichier jusqu’à la fin de son téléchargement : .crdownload pour Chrome et les navigateurs basés sur Chromium, .part pour Firefox et des programmes comme les clients torrent, et .download pour Safari."
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Download conservati, così puoi reinstallarli"
+ "value" : "Download mai completati, ancora con il nome che un file ha finché il download non termina: .crdownload per Chrome e i browser basati su Chromium, .part per Firefox e per programmi come i client torrent, e .download per Safari."
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
- "value" : "再インストールできるように保管されているダウンロード"
+ "value" : "完了しなかったダウンロードです。ダウンロードが終わるまでファイルに付けられている名前のまま残っています。Chromeと、Chromiumをベースにしたブラウザでは.crdownload、Firefoxや、トレントクライアントなどのプログラムでは.part、Safariでは.downloadです。"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
- "value" : "다운로드 파일, 다시 설치할 수 있도록 보관됨"
+ "value" : "완료되지 않은 다운로드로, 다운로드가 끝날 때까지 파일에 붙는 이름이 아직 그대로 남아 있습니다. Chrome 및 Chromium 기반 브라우저는 .crdownload, Firefox와 토렌트 클라이언트 같은 프로그램은 .part, Safari는 .download입니다."
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Downloads, bewaard zodat je ze opnieuw kunt installeren"
+ "value" : "Downloads die nooit zijn voltooid, nog onder de naam die een bestand heeft tot de download klaar is: .crdownload voor Chrome en de browsers die op Chromium zijn gebouwd, .part voor Firefox en programma's zoals torrentclients, en .download voor Safari."
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Pobrane pliki zachowane do ponownej instalacji"
+ "value" : "Pliki, których pobieranie nigdy się nie zakończyło, wciąż pod nazwą, jaką plik ma do końca pobierania: .crdownload w Chrome i przeglądarkach opartych na Chromium, .part w przeglądarce Firefox i programach takich jak klienty torrentów oraz .download w Safari."
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Downloads guardados para que você possa instalá-los de novo"
+ "value" : "Downloads nunca concluídos, ainda com o nome que um arquivo tem até o fim do download: .crdownload no Chrome e nos navegadores baseados no Chromium, .part no Firefox e em programas como clientes de torrent, e .download no Safari."
}
},
"ro" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Descărcări păstrate ca să le puteți instala din nou"
+ "value" : "Descărcări care nu s‑au terminat niciodată, încă sub numele pe care îl are un fișier până la încheierea descărcării: .crdownload pentru Chrome și browserele bazate pe Chromium, .part pentru Firefox și pentru programe precum clienții de torrent, iar .download pentru Safari."
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Загрузки, которые хранятся, чтобы Вы могли установить их снова"
+ "value" : "Загрузки, которые так и не завершились. У таких файлов все еще временное имя, которое файл носит до окончания загрузки: .crdownload в Chrome и браузерах на основе Chromium, .part в Firefox и программах вроде торрент-клиентов, а .download в Safari."
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Hämtningar som sparas så att du kan installera dem igen"
+ "value" : "Hämtningar som aldrig slutfördes, fortfarande under det namn som en fil har tills hämtningen är klar: .crdownload för Chrome och webbläsarna som bygger på Chromium, .part för Firefox och program som torrentklienter, och .download för Safari."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Yeniden yükleyebilmeniz için saklanan indirmeler"
+ "value" : "Hiç tamamlanmamış indirmeler; bir dosyanın, indirmesi bitene kadar taşıdığı adı hâlâ taşırlar: Chrome ve Chromium tabanlı tarayıcılar için .crdownload, Firefox ve torrent istemcileri gibi programlar için .part ve Safari için .download."
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Викачані файли, які зберігаються, щоб ви могли інсталювати їх знову"
+ "value" : "Викачування, які так і не завершилися. Файл досі має назву, яку отримує на час викачування: .crdownload у Chrome і браузерах на основі Chromium, .part у Firefox і таких програмах, як торент-клієнти, та .download у Safari."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "下载文件,保留下来以便你重新安装"
+ "value" : "未完成的下载,仍使用文件在下载结束前的名称:Chrome及基于Chromium的浏览器为.crdownload,Firefox和种子客户端等程序为.part,Safari浏览器为.download。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
- "value" : "下載檔案,保留供你重新安裝"
+ "value" : "未完成的下載項目,仍使用檔案在下載結束前所用的名稱:Chrome及以Chromium為基礎的瀏覽器使用.crdownload,Firefox及torrent用戶端等程式使用.part,Safari使用.download。"
}
}
}
@@ -94421,6 +94421,112 @@
}
}
},
+ "Not selected: a program that resumes downloads, such as a torrent client, may still finish this." : {
+ "localizations" : {
+ "cs" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nevybráno: program, který navazuje přerušená stahování, například torrentový klient, může toto stahování ještě dokončit."
+ }
+ },
+ "de" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nicht ausgewählt: Ein Programm, das Downloads fortsetzt, etwa ein Torrent-Client, schließt diesen Download möglicherweise noch ab."
+ }
+ },
+ "es" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Sin seleccionar: un programa que reanuda descargas, como un cliente de torrent, aún podría terminar esta descarga."
+ }
+ },
+ "fr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non sélectionné : un programme qui reprend les téléchargements, comme un client torrent, peut encore terminer celui-ci."
+ }
+ },
+ "it" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Non selezionato: un programma che riprende i download, come un client torrent, potrebbe ancora completarlo."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未選択: トレントクライアントなど、ダウンロードを再開するプログラムが、まだこれを完了させる可能性があります。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "선택되지 않음: 토렌트 클라이언트처럼 다운로드를 이어서 받는 프로그램이 아직 이 다운로드를 완료할 수 있습니다."
+ }
+ },
+ "nl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Niet geselecteerd: een programma dat downloads hervat, zoals een torrentclient, voltooit dit misschien nog."
+ }
+ },
+ "pl" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nie zaznaczono: program, który wznawia pobieranie, na przykład klient torrentów, może jeszcze dokończyć pobieranie tego pliku."
+ }
+ },
+ "pt" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Não selecionado: um programa que retoma downloads, como um cliente de torrent, ainda pode concluir este download."
+ }
+ },
+ "ro" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Neselectat: un program care reia descărcările, cum ar fi un client de torrent, poate încă să termine această descărcare."
+ }
+ },
+ "ru" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Не выбрано: программа, которая возобновляет загрузки, например торрент-клиент, еще может завершить эту загрузку."
+ }
+ },
+ "sv" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Inte markerad: ett program som återupptar hämtningar, till exempel en torrentklient, kan fortfarande slutföra den här hämtningen."
+ }
+ },
+ "tr" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Seçilmedi: torrent istemcisi gibi, indirmeleri kaldığı yerden sürdüren bir program bunu hâlâ tamamlayabilir."
+ }
+ },
+ "uk" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Не вибрано: програма, яка відновлює викачування, як-от торент-клієнт, ще може його завершити."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未选择:能够续传下载的程序(例如种子客户端)可能仍会完成此下载。"
+ }
+ },
+ "zh-Hant" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "未選取:可接續下載的程式(例如torrent用戶端)可能仍會完成此下載。"
+ }
+ }
+ }
+ },
"Not selected: a report macOS wrote when the app crashed, which its developer may still ask you for." : {
"localizations" : {
"cs" : {
diff --git a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
index bf373782..685ce647 100644
--- a/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
+++ b/Packages/PeelCore/Sources/PeelCommandLine/Support/Output.swift
@@ -365,6 +365,7 @@ extension HoldBack {
case .inTheCloud: "syncs to your other devices through iCloud or another app, so moving it would remove it from them too"
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"
+ case .mayStillBeResumed: "a program that resumes downloads, such as a torrent client, may still finish it"
case .writtenRecently: "written to in the last 15 minutes, so a program may still be using it"
case .keptByAnApp: "in an app's folder in Application Support, and the app may still need it"
case .appIsRunning: "its app is running and may install this update when it quits"
diff --git a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
index 12507d98..c98015c7 100644
--- a/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Leftovers/Leftover.swift
@@ -133,6 +133,9 @@ public enum HoldBack: String, Sendable, Hashable {
case openInAProgram
/// A download that changed within the last day, which may still be going.
case changedRecently
+ /// A `.part` file no browser left, which a program that resumes downloads, such as a torrent client, may still
+ /// finish.
+ case mayStillBeResumed
/// A cache something wrote to in the last few minutes, which a program may still be using.
case writtenRecently
/// An installer package in a folder an app keeps in Application Support, which the app may still need.
diff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
index a221780a..63696482 100644
--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift
@@ -587,12 +587,15 @@ public enum Installers {
/// 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. A package changes when the file growing inside it does (`newestInside`).
+ /// A `.part` file is a browser's only beside the empty file Firefox makes under the final name before it starts
+ /// (`DownloadCore.sys.mjs`): torrent clients and other programs that resume downloads use `.part` too.
static func incompleteDownload(
at url: URL, size: Int64?, heldBack: HoldBack?, newestInside: Date?
) -> InstallerItem {
let own = (try? url.resourceValues(forKeys: [.contentModificationDateKey]))?.contentModificationDate
let changed = [own, newestInside].compactMap(\.self).max()
let isRecent = changed.map { Date.now.timeIntervalSince($0) < stillDownloading } ?? true
+ let mayBeResumed = url.pathExtension.lowercased() == "part" && !isEmptyFile(url.deletingPathExtension())
return InstallerItem(
url: url,
kind: .incompleteDownload,
@@ -603,10 +606,16 @@ public enum Installers {
isReadOnly: false,
notes: [],
requiresPrivileges: FileAccess.requiresPrivilegesToRemove(url),
- heldBack: heldBack ?? (isRecent ? .changedRecently : nil)
+ heldBack: heldBack ?? (isRecent ? .changedRecently : mayBeResumed ? .mayStillBeResumed : nil)
)
}
+ private static func isEmptyFile(_ url: URL) -> Bool {
+ var info = stat()
+ guard lstat(url.path(percentEncoded: false), &info) == 0 else { return false }
+ return info.st_mode & S_IFMT == S_IFREG && info.st_size == 0
+ }
+
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.swift
index 03cf6184..b4a4fd5e 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift
@@ -375,6 +375,27 @@ struct InstallersTests {
#expect(items["Archive.zip.part"]?.heldBack == .changedRecently)
}
+ @Test func aPartFileNoBrowserLeftIsLeftToChoose() async throws {
+ let directory = try TemporaryDirectory()
+ let torrent = try directory.file("Downloads/Film.mkv.part", bytes: 400_000)
+ let firefox = try directory.file("Downloads/Disk.dmg.part", bytes: 400_000)
+ try directory.file("Downloads/Disk.dmg", bytes: 0)
+ try directory.directory("Applications")
+ let old: [FileAttributeKey: Any] = [.modificationDate: Date.now.addingTimeInterval(-3 * 24 * 60 * 60)]
+ for url in [torrent, firefox] {
+ try FileManager.default.setAttributes(old, ofItemAtPath: url.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(items["Film.mkv.part"]?.heldBack == .mayStillBeResumed)
+ #expect(items["Disk.dmg.part"]?.heldBack == .some(nil))
+ }
+
/// Safari keeps a download in a `.download` package until it ends. The package is the unfinished download, and
/// the file growing inside it is what says when it last changed.
@Test func findsSafarisUnfinishedDownloadsByTheirNewestWrite() async throws {
diff --git a/Peel/Model/InstallerLibrary.swift b/Peel/Model/InstallerLibrary.swift
index 934e8c8b..84f71e1d 100644
--- a/Peel/Model/InstallerLibrary.swift
+++ b/Peel/Model/InstallerLibrary.swift
@@ -98,7 +98,7 @@ nonisolated 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, and .download for Safari."
+ case .incompleteDownload: "Downloads never finished, still under the name a file has until its download ends: .crdownload for Chrome and the browsers built on Chromium, .part for Firefox and programs such as torrent clients, and .download for Safari."
case .updateDownload: "Updates an app downloaded with Sparkle, Squirrel, or electron-updater and keeps in its caches until it installs them. If one is gone, the app downloads it again the next time it updates."
}
}
diff --git a/Peel/Views/Presentation.swift b/Peel/Views/Presentation.swift
index 3fe55ade..b80a2e55 100644
--- a/Peel/Views/Presentation.swift
+++ b/Peel/Views/Presentation.swift
@@ -375,6 +375,8 @@ extension HoldBack {
"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."
+ case .mayStillBeResumed:
+ "Not selected: a program that resumes downloads, such as a torrent client, may still finish this."
case .writtenRecently:
"Not selected: something wrote to this in the last 15 minutes, so a program may still be using it."
case .keptByAnApp: