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
List the updates electron-updater downloaded in Installers and Backups
Țugui Dragoș3839ce8325fd
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstringsindex c41a5e49..ae2ddc48 100644--- a/Localization/Peel/Localizable.xcstrings+++ b/Localization/Peel/Localizable.xcstrings@@ -170056,108 +170056,108 @@}}},- "Updates an app downloaded with Sparkle or Squirrel and keeps in its caches until it installs them. If one is gone, the app downloads it again the next time it updates." : {+ "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." : {"localizations" : {"cs" : {"stringUnit" : {"state" : "translated",- "value" : "Aktualizace, které aplikace stáhla pomocí Sparkle nebo Squirrel a uchovává je ve svých mezipamětech, dokud je nenainstaluje. Pokud některá z nich chybí, aplikace ji při příští aktualizaci stáhne znovu."+ "value" : "Aktualizace, které aplikace stáhla pomocí Sparkle, Squirrel nebo electron-updater a uchovává je ve svých mezipamětech, dokud je nenainstaluje. Pokud některá z nich chybí, aplikace ji při příští aktualizaci stáhne znovu."}},"de" : {"stringUnit" : {"state" : "translated",- "value" : "Updates, die eine App mit Sparkle oder Squirrel geladen hat und in ihren Caches aufbewahrt, bis sie sie installiert. Fehlt eines, lädt die App es beim nächsten Update erneut."+ "value" : "Updates, die eine App mit Sparkle, Squirrel oder electron-updater geladen hat und in ihren Caches aufbewahrt, bis sie sie installiert. Fehlt eines, lädt die App es beim nächsten Update erneut."}},"es" : {"stringUnit" : {"state" : "translated",- "value" : "Actualizaciones que una app descargó con Sparkle o Squirrel y guarda en sus cachés hasta instalarlas. Si falta alguna, la app la vuelve a descargar la próxima vez que se actualice."+ "value" : "Actualizaciones que una app descargó con Sparkle, Squirrel o electron-updater y guarda en sus cachés hasta instalarlas. Si falta alguna, la app la vuelve a descargar la próxima vez que se actualice."}},"fr" : {"stringUnit" : {"state" : "translated",- "value" : "Mises à jour qu’une app a téléchargées avec Sparkle ou Squirrel et qu’elle conserve dans ses caches jusqu’à ce qu’elle les installe. Si l’une d’elles a disparu, l’app la télécharge à nouveau lors de sa prochaine mise à jour."+ "value" : "Mises à jour qu’une app a téléchargées avec Sparkle, Squirrel ou electron-updater et qu’elle conserve dans ses caches jusqu’à ce qu’elle les installe. Si l’une d’elles a disparu, l’app la télécharge à nouveau lors de sa prochaine mise à jour."}},"it" : {"stringUnit" : {"state" : "translated",- "value" : "Aggiornamenti che un’app ha scaricato con Sparkle o Squirrel e conserva nelle sue cache finché non li installa. Se uno non c’è più, l’app lo scarica di nuovo al prossimo aggiornamento."+ "value" : "Aggiornamenti che un’app ha scaricato con Sparkle, Squirrel o electron-updater e conserva nelle sue cache finché non li installa. Se uno non c’è più, l’app lo scarica di nuovo al prossimo aggiornamento."}},"ja" : {"stringUnit" : {"state" : "translated",- "value" : "アプリがSparkleまたはSquirrelでダウンロードし、インストールするまでキャッシュに保管しているアップデートです。なくなった場合は、アプリが次にアップデートするときに再びダウンロードします。"+ "value" : "アプリがSparkle、Squirrel、またはelectron-updaterでダウンロードし、インストールするまでキャッシュに保管しているアップデートです。なくなった場合は、アプリが次にアップデートするときに再びダウンロードします。"}},"ko" : {"stringUnit" : {"state" : "translated",- "value" : "앱이 Sparkle 또는 Squirrel로 다운로드하여 설치할 때까지 캐시에 보관하는 업데이트입니다. 업데이트가 없어지면 앱이 다음에 업데이트할 때 다시 다운로드합니다."+ "value" : "앱이 Sparkle, Squirrel 또는 electron-updater로 다운로드하여 설치할 때까지 캐시에 보관하는 업데이트입니다. 업데이트가 없어지면 앱이 다음에 업데이트할 때 다시 다운로드합니다."}},"nl" : {"stringUnit" : {"state" : "translated",- "value" : "Updates die een app met Sparkle of Squirrel heeft gedownload en in de eigen caches bewaart totdat de app ze installeert. Is er een verdwenen, dan downloadt de app die opnieuw bij de volgende update."+ "value" : "Updates die een app met Sparkle, Squirrel of electron-updater heeft gedownload en in de eigen caches bewaart totdat de app ze installeert. Is er een verdwenen, dan downloadt de app die opnieuw bij de volgende update."}},"pl" : {"stringUnit" : {"state" : "translated",- "value" : "Uaktualnienia, które aplikacja pobrała za pomocą Sparkle lub Squirrel i przechowuje w swoich pamięciach podręcznych, dopóki ich nie zainstaluje. Jeśli któregoś zabraknie, aplikacja pobierze je ponownie przy następnym uaktualnieniu."+ "value" : "Uaktualnienia, które aplikacja pobrała za pomocą Sparkle, Squirrel lub electron-updater i przechowuje w swoich pamięciach podręcznych, dopóki ich nie zainstaluje. Jeśli któregoś zabraknie, aplikacja pobierze je ponownie przy następnym uaktualnieniu."}},"pt" : {"stringUnit" : {"state" : "translated",- "value" : "Atualizações que um app baixou com o Sparkle ou o Squirrel e guarda nos seus caches até instalá-las. Se uma delas não estiver mais lá, o app a baixa novamente na próxima vez que se atualizar."+ "value" : "Atualizações que um app baixou com o Sparkle, o Squirrel ou o electron-updater e guarda nos seus caches até instalá-las. Se uma delas não estiver mais lá, o app a baixa novamente na próxima vez que se atualizar."}},"ro" : {"stringUnit" : {"state" : "translated",- "value" : "Actualizări pe care o aplicație le‑a descărcat cu Sparkle sau Squirrel și le păstrează în memoriile sale tampon până când le instalează. Dacă una lipsește, aplicația o descarcă din nou data viitoare când se actualizează."+ "value" : "Actualizări pe care o aplicație le‑a descărcat cu Sparkle, Squirrel sau electron-updater și le păstrează în memoriile sale tampon până când le instalează. Dacă una lipsește, aplicația o descarcă din nou data viitoare când se actualizează."}},"ru" : {"stringUnit" : {"state" : "translated",- "value" : "Обновления, которые приложение загрузило с помощью Sparkle или Squirrel и хранит в своих кэшах, пока не установит их. Если какого-то из них больше нет, приложение снова загрузит его при следующем обновлении."+ "value" : "Обновления, которые приложение загрузило с помощью Sparkle, Squirrel или electron-updater и хранит в своих кэшах, пока не установит их. Если какого-то из них больше нет, приложение снова загрузит его при следующем обновлении."}},"sv" : {"stringUnit" : {"state" : "translated",- "value" : "Uppdateringar som en app har hämtat med Sparkle eller Squirrel och sparar i sina cachar tills den installerar dem. Om en av dem är borta hämtar appen den igen nästa gång den uppdateras."+ "value" : "Uppdateringar som en app har hämtat med Sparkle, Squirrel eller electron-updater och sparar i sina cachar tills den installerar dem. Om en av dem är borta hämtar appen den igen nästa gång den uppdateras."}},"tr" : {"stringUnit" : {"state" : "translated",- "value" : "Bir uygulamanın Sparkle veya Squirrel ile indirdiği ve yükleyene kadar önbelleklerinde tuttuğu güncellemeler. Biri artık yoksa, uygulama bir sonraki güncellemesinde onu yeniden indirir."+ "value" : "Bir uygulamanın Sparkle, Squirrel veya electron-updater ile indirdiği ve yükleyene kadar önbelleklerinde tuttuğu güncellemeler. Biri artık yoksa, uygulama bir sonraki güncellemesinde onu yeniden indirir."}},"uk" : {"stringUnit" : {"state" : "translated",- "value" : "Оновлення, які програма викачала за допомогою Sparkle або Squirrel і зберігає у своїх кешах, доки не інсталює їх. Якщо одного з них немає, програма викачає його знову під час наступного оновлення."+ "value" : "Оновлення, які програма викачала за допомогою Sparkle, Squirrel або electron-updater і зберігає у своїх кешах, доки не інсталює їх. Якщо одного з них немає, програма викачає його знову під час наступного оновлення."}},"zh-Hans" : {"stringUnit" : {"state" : "translated",- "value" : "App通过Sparkle或Squirrel下载、并在安装之前保留在其缓存中的更新。如果某个更新已不在,该App会在下次更新时重新下载它。"+ "value" : "App通过Sparkle、Squirrel或electron-updater下载、并在安装之前保留在其缓存中的更新。如果某个更新已不在,该App会在下次更新时重新下载它。"}},"zh-Hant" : {"stringUnit" : {"state" : "translated",- "value" : "App透過Sparkle或Squirrel下載、並在安裝前保留在其快取中的更新項目。如果某個更新項目已不存在,App會在下次更新時重新下載它。"+ "value" : "App透過Sparkle、Squirrel或electron-updater下載、並在安裝前保留在其快取中的更新項目。如果某個更新項目已不存在,App會在下次更新時重新下載它。"}}}diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift b/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swiftindex bd1ae2fe..29be85e8 100644--- a/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift+++ b/Packages/PeelCore/Sources/PeelCore/Apps/AppInspector.swift@@ -88,6 +88,7 @@ public enum AppInspector {let isFromAppStore = FileManager.default.fileExists(atPath: receipt.path(percentEncoded: false))let isSystemProtected = isSystemProtected(url)let use = use(of: url)+ let electronConfiguration = ElectronUpdater.configuration(in: contents)return InstalledApp(url: url,@@ -110,10 +111,11 @@ public enum AppInspector {dateAdded: dateAdded(of: url),updateFeed: UpdateFeed.detect(info: info,- contents: contents,+ electronConfiguration: electronConfiguration,isFromAppStore: isFromAppStore,isSystemProtected: isSystemProtected),+ updaterFolder: electronConfiguration.flatMap(ElectronUpdater.downloadsFolder(fromConfiguration:)),webApp: bundleIdentifier.flatMap { WebApp.of(identifier: $0, info: info) })}diff --git a/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift b/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swiftindex ea1b4175..39e21fda 100644--- a/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift+++ b/Packages/PeelCore/Sources/PeelCore/Apps/InstalledApp.swift@@ -28,6 +28,9 @@ public struct InstalledApp: Sendable, Hashable, Identifiable {public let isUseRecorded: Boolpublic let dateAdded: Date?public let updateFeed: UpdateFeed?+ /// The folder electron-updater keeps the app's downloads in, as the app's own settings name it, or nil for an app+ /// without electron-updater (`ElectronUpdater`).+ public let updaterFolder: String?/// Whether this is Peel, which is removed only from its own Settings, where the helper and the login item/// are unregistered first. Also true for the bundle the running code sits inside, such as the Peel that/// embeds the `peel` tool, whatever its name or identifier.@@ -63,6 +66,7 @@ public struct InstalledApp: Sendable, Hashable, Identifiable {isUseRecorded: Bool = true,dateAdded: Date? = nil,updateFeed: UpdateFeed? = nil,+ updaterFolder: String? = nil,webApp: WebApp? = nil) {self.url = url@@ -84,6 +88,7 @@ public struct InstalledApp: Sendable, Hashable, Identifiable {self.dateAdded = dateAddedself.webApp = webAppself.updateFeed = updateFeed+ self.updaterFolder = updaterFolderlet path = PathPattern.comparablePath(of: url)isPeelItself = Self.isPeel(self.bundleIdentifier, at: path)isTheRunningCopy = path == Self.runningBundle@@ -139,6 +144,7 @@ public struct InstalledApp: Sendable, Hashable, Identifiable {isUseRecorded: isRecorded,dateAdded: dateAdded,updateFeed: updateFeed,+ updaterFolder: updaterFolder,webApp: webApp)}diff --git a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swiftindex 452f376e..3fcafa6f 100644--- a/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift+++ b/Packages/PeelCore/Sources/PeelCore/Space/Installers.swift@@ -12,7 +12,7 @@ public struct InstallerItem: Sendable, Hashable, Identifiable {case deviceBackup/// A download a browser never finished, still under the name it writes to until the end.case incompleteDownload- /// An update an app downloaded with Sparkle or Squirrel, which it keeps in its caches until it installs it.+ /// An update an app downloaded with Sparkle, Squirrel, or electron-updater, kept until it is installed.case updateDownload}@@ -460,10 +460,11 @@ public enum Installers {return items}- /// The updates apps downloaded and keep in `~/Library/Caches`: Sparkle's folder inside the app's own,- /// `<identifier>/org.sparkle-project.Sparkle` (`SPULocalCacheDirectory.m`, which adds `.sparkle` to an identifier- /// ending like a bundle), and Squirrel's `<identifier>.ShipIt` (`SQRLShipItLauncher.m`). A folder the Developer- /// table lists is left to Developer.+ /// The updates apps downloaded and keep until they install them: in `~/Library/Caches`, Sparkle's folder inside+ /// the app's own, `<identifier>/org.sparkle-project.Sparkle` (`SPULocalCacheDirectory.m`, which adds `.sparkle`+ /// to an identifier ending like a bundle), and Squirrel's `<identifier>.ShipIt` (`SQRLShipItLauncher.m`); there+ /// and in its former place, electron-updater's folder (`ElectronUpdater`). A folder the Developer table lists is+ /// left to Developer.static func updateDownloads(home: URL,installedApps: [InstalledApp],@@ -477,33 +478,56 @@ public enum Installers {let developers = Set(DeveloperCaches.definitions.flatMap(\.folders).filter { $0.base == .home }.map {$0.path.lowercased()})- var found: [(url: URL, identifier: String)] = []+ let installed = { (identifier: String) in installedApps.first { $0.bundleIdentifier == identifier } }+ let updaters = Dictionary(+ installedApps.compactMap { app in app.updaterFolder.map { ($0.lowercased(), app) } }+ ) { first, _ in first }+ var found: [(url: URL, identifier: String?, app: InstalledApp?)] = []+ // A folder an installed app's settings name, or one named as electron-builder names them all.+ let addIfElectronUpdaters = { (url: URL) in+ let name = url.lastPathComponent.lowercased()+ let app = updaters[name]+ guard app != nil || name.hasSuffix("-updater"), ElectronUpdater.holdsADownload(url) else { return }+ found.append((url, app?.bundleIdentifier, app))+ }for url in files(in: caches) where url.isRealFolder {let name = url.lastPathComponentguard !developers.contains("library/caches/" + name.lowercased()) else { continue }if name.hasSuffix(".ShipIt") {- found.append((url, String(name.dropLast(".ShipIt".count))))+ let identifier = String(name.dropLast(".ShipIt".count))+ found.append((url, identifier, installed(identifier)))}let sparkle = url.appending(path: "org.sparkle-project.Sparkle", directoryHint: .isDirectory)if sparkle.isRealFolder {- found.append((sparkle, name.removingSuffix(".sparkle")))+ let identifier = name.removingSuffix(".sparkle")+ found.append((sparkle, identifier, installed(identifier)))+ }+ addIfElectronUpdaters(url)+ }+ let former = home.appending(path: ElectronUpdater.formerPlace, directoryHint: .isDirectory)+ for url in files(in: former) where url.isRealFolder {+ guard !developers.contains("\(ElectronUpdater.formerPlace)/\(url.lastPathComponent)".lowercased()) else {+ continue}+ addIfElectronUpdaters(url)}let place = Folder(url: caches, isSharedWithEveryone: false)var items: [InstallerItem] = []- for (url, identifier) in found {+ for (url, identifier, app) in found {guard !Task.isCancelled else { return items }guard !exclusions.excludes(url), !exclusions.holds(url) else { continue }let (size, seen, _) = await measured(url, by: measure)guard isWorthARow(size, minimumSize) else { continue }- let isRunning = !NSRunningApplication.runningApplications(withBundleIdentifier: identifier).isEmpty+ let isRunning = identifier.map {+ !NSRunningApplication.runningApplications(withBundleIdentifier: $0).isEmpty+ } ?? falseitems.append(InstallerItem(url: url,kind: .updateDownload,name: url.lastPathComponent,size: size,date: (try? url.resourceValues(forKeys: [.contentModificationDateKey]))?.contentModificationDate,- installedApp: installedApps.first { $0.bundleIdentifier == identifier }?.name,+ installedApp: app?.name,isReadOnly: false,notes: [],requiresPrivileges: FileAccess.requiresPrivilegesToRemove(url),diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/ElectronUpdater.swift b/Packages/PeelCore/Sources/PeelCore/Updates/ElectronUpdater.swiftindex 04c29926..315bb62f 100644--- a/Packages/PeelCore/Sources/PeelCore/Updates/ElectronUpdater.swift+++ b/Packages/PeelCore/Sources/PeelCore/Updates/ElectronUpdater.swift@@ -1,6 +1,35 @@import Foundationenum ElectronUpdater {+ /// Where electron-updater kept an app's downloads before version 6, relative to the home folder. Since then they+ /// are in `~/Library/Caches` (`AppAdapter.ts`).+ static let formerPlace = "Library/Application Support/Caches"++ /// The app's electron-updater settings, `Resources/app-update.yml` in `contents`, or nil when it has none. A real+ /// one is a few lines, so anything over 64 KB, or anything that is not a regular file, is ignored.+ static func configuration(in contents: URL) -> String? {+ BoundedRead.data(at: contents.appending(path: "Resources/app-update.yml"), maximum: 64 * 1_024)+ .map { String(decoding: $0, as: UTF8.self) }+ }++ /// The folder the settings name for the app's downloads (`updaterCacheDirName`, which electron-builder writes as+ /// the app's name and `-updater`).+ static func downloadsFolder(fromConfiguration text: String) -> String? {+ guard let name = topLevelFields(in: text)["updaterCacheDirName"], !name.contains("/"), name != ".", name != ".."+ else { return nil }+ return name+ }++ /// Whether `folder` holds what electron-updater writes there: `update.zip`, the last update, kept for the next+ /// differential download, or `pending/update-info.json`, beside the update it downloaded.+ static func holdsADownload(_ folder: URL) -> Bool {+ ["update.zip", "pending/update-info.json"].contains { name in+ var info = stat()+ return lstat(folder.appending(path: name).path(percentEncoded: false), &info) == 0+ && info.st_mode & S_IFMT == S_IFREG+ }+ }+static func feedURL(fromConfiguration text: String) -> URL? {let fields = topLevelFields(in: text)let file = "\(fields["channel"] ?? "latest")-mac.yml"diff --git a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateFeed.swift b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateFeed.swiftindex 9988c371..90352311 100644--- a/Packages/PeelCore/Sources/PeelCore/Updates/UpdateFeed.swift+++ b/Packages/PeelCore/Sources/PeelCore/Updates/UpdateFeed.swift@@ -59,7 +59,7 @@ public enum UpdateStatus: Sendable, Hashable, Codable {extension UpdateFeed {static func detect(info: [String: Any],- contents: URL,+ electronConfiguration: String?,isFromAppStore: Bool,isSystemProtected: Bool) -> UpdateFeed? {@@ -70,11 +70,7 @@ extension UpdateFeed {if let feed = (info["SUFeedURL"] as? String).flatMap(URL.init(string:)), feed.scheme == "https" {return .sparkle(feed)}- let configuration = contents.appending(path: "Resources/app-update.yml")- // The app's own file, read for every bundle on every refresh. A real one is a few lines, so anything- // over 64 KB, or anything that is not a regular file, is ignored.- if let data = BoundedRead.data(at: configuration, maximum: 64 * 1_024),- let feed = ElectronUpdater.feedURL(fromConfiguration: String(decoding: data, as: UTF8.self)) {+ if let feed = electronConfiguration.flatMap(ElectronUpdater.feedURL(fromConfiguration:)) {return .electron(feed)}// An app that names no update source gets no feed. Asking Apple about it would send its identifierdiff --git a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swiftindex d4ad3588..ab72587d 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/InstallersTests.swift@@ -436,6 +436,46 @@ struct InstallersTests {#expect(items["com.apple.finder.ShipIt"]?.heldBack == .appIsRunning)}+ /// electron-updater keeps what it downloads in the folder its app's `app-update.yml` names, in `~/Library/Caches`,+ /// or in `~/Library/Application Support/Caches` before electron-updater 6.+ @Test func findsWhatElectronUpdaterDownloadedInEitherPlace() async throws {+ let directory = try TemporaryDirectory()+ let old = "Library/Application Support/Caches"+ try directory.file("\(old)/notes-updater/update.zip", bytes: 400_000)+ try directory.file("\(old)/notes-updater/pending/update-info.json", bytes: 100)+ try directory.file("Library/Caches/studio-updater/pending/update-info.json", bytes: 100)+ try directory.file("Library/Caches/studio-updater/pending/Studio-2.0-mac.zip", bytes: 400_000)+ try directory.file("Library/Caches/finder-updater/update.zip", bytes: 400_000)+ try directory.file("\(old)/gone-updater/update.zip", bytes: 400_000)+ try directory.file("\(old)/tide/update.zip", bytes: 400_000)+ try directory.file("\(old)/other-updater/settings.json", bytes: 400_000)+ try directory.file("\(old)/notes/update.zip", bytes: 400_000)+ try directory.directory("Applications")+ let installed = [+ ("Notes", "org.example.notes", "notes-updater"), ("Studio", "org.example.studio", "studio-updater"),+ ("Finder", "com.apple.finder", "finder-updater"), ("Tide", "org.example.tide", "tide"),+ ].map { name, identifier, folder in+ InstalledApp(+ url: URL(filePath: "/Applications/\(name).app"), bundleIdentifier: identifier, name: name,+ updaterFolder: folder+ )+ }++ let scan = await Installers.scan(+ installedApps: installed, home: directory.url, root: directory.url, exclusions: .none,+ minimumSize: 100_000, measure: LeftoverScanner.walk, openFiles: OpenFiles(excluding: nil)+ )++ let items = Dictionary(uniqueKeysWithValues: scan.items(in: .updateDownload).map { ($0.name, $0) })+ #expect(Set(items.keys) == ["notes-updater", "studio-updater", "finder-updater", "gone-updater", "tide"])+ #expect(items["notes-updater"]?.installedApp == "Notes")+ #expect(items["studio-updater"]?.installedApp == "Studio")+ #expect(items["tide"]?.installedApp == "Tide")+ #expect(items["gone-updater"]?.installedApp == nil)+ #expect(items["notes-updater"]?.heldBack == .some(nil))+ #expect(items["finder-updater"]?.heldBack == .appIsRunning)+ }+@Test func aDownloadAProgramStillHasOpenIsLeftForThePersonToChoose() async throws {let directory = try TemporaryDirectory()let downloading = try directory.file("Downloads/Tool-1.dmg", bytes: 400_000)diff --git a/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swiftindex c95c1146..e28c1556 100644--- a/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift+++ b/Packages/PeelCore/Tests/PeelCoreTests/UpdateTests.swift@@ -353,35 +353,50 @@ struct UpdateFeedDetectionTests {#expect(electronApp.updateFeed == .electron(URL(string: "https://example.com/updates/latest-mac.yml")!))}+ @Test func readsTheFolderElectronUpdaterKeepsItsDownloadsIn() throws {+ let cases: [(settings: String, folder: String?)] = [+ ("provider: generic\nurl: https://example.com/updates\nupdaterCacheDirName: notes-updater\n", "notes-updater"),+ ("provider: generic\r\nupdaterCacheDirName: 'notes-updater'\r\n", "notes-updater"),+ ("updaterCacheDirName: \"@example_notes-updater\"\n", "@example_notes-updater"),+ ("provider: generic\nurl: https://example.com/updates\n", nil),+ ("updaterCacheDirName: ../notes-updater\n", nil),+ ("publish:\n updaterCacheDirName: notes-updater\n", nil),+ ]+ for (settings, folder) in cases {+ let directory = try TemporaryDirectory()+ let app = try #require(+ AppInspector.inspect(try bundle(info: [:], files: ["Resources/app-update.yml": settings], in: directory))+ )+ #expect(app.updaterFolder == folder, "\(settings)")+ }+ }+/// Apps that come with macOS are kept current by Software Update, whatever feed their bundle names. The test/// uses a bundle with a feed, since Calculator names none and would pass with or without the rule.@Test func skipsSystemApps() throws {- let directory = try TemporaryDirectory()- let contents = try directory.directory("Example.app/Contents")let info = ["SUFeedURL": "https://example.com/appcast.xml"]#expect(- UpdateFeed.detect(info: info, contents: contents, isFromAppStore: false, isSystemProtected: true) == nil+ UpdateFeed.detect(info: info, electronConfiguration: nil, isFromAppStore: false, isSystemProtected: true)+ == nil)#expect(- UpdateFeed.detect(info: info, contents: contents, isFromAppStore: false, isSystemProtected: false)+ UpdateFeed.detect(info: info, electronConfiguration: nil, isFromAppStore: false, isSystemProtected: false)== .sparkle(try #require(URL(string: "https://example.com/appcast.xml"))))}@Test func peelReadsItsOwnFeedAsAnySparkleAppDoes() throws {- let directory = try TemporaryDirectory()- let contents = try directory.directory("Peel.app/Contents")let feed = "https://github.com/TuguiDragos/Peel/releases/latest/download/appcast.xml"let peel = ["CFBundleIdentifier": "com.tuguidragos.Peel", "SUFeedURL": feed]#expect(- UpdateFeed.detect(info: peel, contents: contents, isFromAppStore: false, isSystemProtected: false)+ UpdateFeed.detect(info: peel, electronConfiguration: nil, isFromAppStore: false, isSystemProtected: false)== .sparkle(URL(string: feed)!))#expect(UpdateFeed.detect(info: ["CFBundleIdentifier": "com.tuguidragos.Peel"],- contents: contents,+ electronConfiguration: nil,isFromAppStore: false,isSystemProtected: false) == nildiff --git a/Peel/Model/InstallerLibrary.swift b/Peel/Model/InstallerLibrary.swiftindex eac11ebb..934e8c8b 100644--- a/Peel/Model/InstallerLibrary.swift+++ b/Peel/Model/InstallerLibrary.swift@@ -99,7 +99,7 @@ nonisolated extension InstallerItem.Kind {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 .updateDownload: "Updates an app downloaded with Sparkle or Squirrel and keeps in its caches until it installs them. If one is gone, the app downloads it again the next time it updates."+ 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."}}