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.

Say when Finder or a drop asks for a bundle Peel can't read

Țugui Dragoșe115c24f379d
diff --git a/Localization/Peel/Localizable.xcstrings b/Localization/Peel/Localizable.xcstrings
index 1817845c..a3b9404c 100644
--- a/Localization/Peel/Localizable.xcstrings
+++ b/Localization/Peel/Localizable.xcstrings
@@ -6464,108 +6464,108 @@
}
}
},
- "%@ isn’t there anymore, or macOS doesn’t let this account read it." : {
+ "%@ isn’t there anymore, or Peel can’t read it as an app." : {
"localizations" : {
"cs" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Položka %@ už tam není, nebo ji systém macOS tomuto účtu nedovoluje přečíst."
+ "value" : "Položka %@ už tam není, nebo ji Peel nedokáže přečíst jako aplikaci."
}
},
"de" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ ist nicht mehr vorhanden, oder macOS erlaubt diesem Benutzeraccount nicht, es zu lesen."
+ "value" : "%@ ist nicht mehr vorhanden, oder Peel kann es nicht als App lesen."
}
},
"es" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ ya no está ahí, o macOS no deja que esta cuenta lo lea."
+ "value" : "%@ ya no está ahí, o Peel no puede leerlo como una app."
}
},
"fr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ n’est plus là, ou macOS ne permet pas à ce compte de le lire."
+ "value" : "%@ n’est plus là, ou Peel ne peut pas le lire en tant qu’app."
}
},
"it" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ non c’è più, oppure macOS non ne consente la lettura a questo account."
+ "value" : "%@ non c’è più, oppure per Peel non è leggibile come app."
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@はもうそこにないか、macOSがこのアカウントに読み取りを許可していません。"
+ "value" : "%@はもうそこにないか、Peelがアプリとして読み取れません。"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@이(가) 더 이상 그곳에 없거나, macOS가 이 계정에서 읽지 못하게 합니다."
+ "value" : "%@이(가) 더 이상 그곳에 없거나 Peel이 앱으로 읽을 수 없습니다."
}
},
"nl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ is er niet meer, of macOS laat deze account het niet lezen."
+ "value" : "%@ is er niet meer, of Peel kan het niet als app lezen."
}
},
"pl" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Aplikacji %@ już tam nie ma albo macOS nie pozwala temu kontu jej odczytać."
+ "value" : "Rzeczy %@ już tam nie ma albo Peel nie może odczytać jej jako aplikacji."
}
},
"pt" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ não está mais lá, ou o macOS não permite que esta conta o leia."
+ "value" : "%@ não está mais lá, ou o Peel não consegue lê-lo como um app."
}
},
"ro" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ nu mai este acolo sau macOS nu îi permite acestui cont să îl citească."
+ "value" : "%@ nu mai este acolo sau Peel nu îl poate citi ca aplicație."
}
},
"ru" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Объекта %@ больше нет, или macOS не позволяет этой учетной записи его прочитать."
+ "value" : "Объекта %@ больше нет, или Peel не может прочитать его как приложение."
}
},
"sv" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ finns inte längre, eller så låter macOS inte det här kontot läsa den."
+ "value" : "%@ finns inte längre, eller så kan Peel inte läsa den som en app."
}
},
"tr" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ artık orada değil veya macOS bu hesabın onu okumasına izin vermiyor."
+ "value" : "%@ artık orada değil veya Peel onu bir uygulama olarak okuyamıyor."
}
},
"uk" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@ там уже немає, або macOS не дає цьому обліковому запису це прочитати."
+ "value" : "%@ там уже немає, або Peel не може прочитати це як програму."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@已不存在,或者macOS不允许此账户读取它。"
+ "value" : "%@已不存在,或者Peel无法将其读取为App。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%@已不在那裡,或macOS不允許此帳號讀取它。"
+ "value" : "%@已不在那裡,或Peel無法將它讀取為App。"
}
}
}
diff --git a/Peel/Model/AppLibrary.swift b/Peel/Model/AppLibrary.swift
index fe57e1de..6fed58c2 100644
--- a/Peel/Model/AppLibrary.swift
+++ b/Peel/Model/AppLibrary.swift
@@ -1038,24 +1038,25 @@ final class AppLibrary {
var teamRecordFile: URL { teamRegistry.url }
/// Selects the apps together, adding each first when it lives outside the scanned folders, for example in
- /// the Trash. What is not an app is passed over, and false means none was.
+ /// the Trash. The first Peel can't read is left for the window to say (`couldNotShow`), and false means none
+ /// could be read.
@discardableResult
func reveal(_ urls: [URL]) async -> Bool {
var chosen: Set<InstalledApp.ID> = []
+ var unread: [URL] = []
for url in urls {
if let id = await listed(url) {
chosen.insert(id)
+ } else {
+ unread.append(url)
}
}
+ if let first = unread.first { couldNotShow = first }
guard !chosen.isEmpty else { return false }
selection = chosen
return true
}
- func showRequested(_ app: URL) async {
- if await !reveal([app]) { couldNotShow = app }
- }
-
private func listed(_ url: URL) async -> InstalledApp.ID? {
let bundleURL = url.standardizedFileURL
// Looked up on disk, since a trailing slash, another case, or a link can name a bundle already listed.
diff --git a/Peel/Views/ContentView.swift b/Peel/Views/ContentView.swift
index 215bd509..b94745fc 100644
--- a/Peel/Views/ContentView.swift
+++ b/Peel/Views/ContentView.swift
@@ -164,10 +164,14 @@ struct ContentView: View {
Text("Peel couldn’t open this app"),
isPresented: Binding(get: { library.couldNotShow != nil }, set: { if !$0 { library.couldNotShow = nil } }),
presenting: library.couldNotShow
- ) { _ in
+ ) { app in
+ if !app.isMissing {
+ Button("Show in Finder") { NSWorkspace.shared.activateFileViewerSelecting([app]) }
+ }
Button("OK", role: .cancel) {}
+ .keyboardShortcut(.defaultAction)
} message: { app in
- Text("\(app.abbreviatedPath) isn’t there anymore, or macOS doesn’t let this account read it.")
+ Text("\(app.abbreviatedPath) isn’t there anymore, or Peel can’t read it as an app.")
}
// The window's Undo, so Command-Z after a removal means what it means everywhere else on a Mac.
.focusedSceneValue(\.removalHistory, history)
@@ -183,7 +187,7 @@ struct ContentView: View {
.onChange(of: navigator.requestedApp) { _, app in
guard let app, library.hasLoaded else { return }
navigator.requestedApp = nil
- Task { await library.showRequested(app) }
+ Task { await library.reveal([app]) }
}
}
@@ -397,7 +401,7 @@ struct ContentView: View {
}
if let app = navigator.requestedApp, library.hasLoaded {
navigator.requestedApp = nil
- Task { await library.showRequested(app) }
+ Task { await library.reveal([app]) }
}
}
diff --git a/PeelTests/AppLibraryTests.swift b/PeelTests/AppLibraryTests.swift
index 93449338..54de421a 100644
--- a/PeelTests/AppLibraryTests.swift
+++ b/PeelTests/AppLibraryTests.swift
@@ -268,13 +268,19 @@ private nonisolated final class TestClock: Sendable {
let library = library(with: made.defaults, notesIn: folder)
let gone = folder.appending(path: "Gone.app", directoryHint: .isDirectory)
- await library.showRequested(bundle)
+ await library.reveal([bundle])
#expect(library.couldNotShow == nil)
#expect(library.selection.count == 1)
- await library.showRequested(gone)
+ await library.reveal([gone])
#expect(library.couldNotShow == gone)
#expect(library.selection.count == 1)
+
+ let broken = folder.appending(path: "Broken.app/Contents", directoryHint: .isDirectory)
+ try FileManager.default.createDirectory(at: broken, withIntermediateDirectories: true)
+ library.couldNotShow = nil
+ #expect(await library.reveal([bundle, broken.deletingLastPathComponent()]))
+ #expect(library.couldNotShow?.lastPathComponent == "Broken.app")
}
@Test func anOlderAppStoreAnswerLeavesTheUpdateItFound() async throws {