Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

fix: explain rejected drops instead of silently ignoring them

Gauthier Piarrette7a4825e8fbb4
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
index e701800..529d699 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -98,8 +98,15 @@ struct BottleView: View {
.onDrop(of: [.fileURL], isTargeted: nil) { providers in
guard let provider = providers.first else { return false }
_ = provider.loadObject(ofClass: URL.self) { url, _ in
- guard let url, ["exe", "msi", "bat"].contains(url.pathExtension.lowercased()) else { return }
- Task { @MainActor in state.pendingRun = url }
+ guard let url else { return }
+ if ["exe", "msi", "bat"].contains(url.pathExtension.lowercased()) {
+ Task { @MainActor in state.pendingRun = url }
+ } else {
+ // Silently ignoring a drop reads as "nothing happened" (Reddit report) — say why.
+ Task { @MainActor in
+ state.errorMessage = String(format: L("'%@' isn't a Windows program. You can drop .exe, .msi or .bat files here."), url.lastPathComponent)
+ }
+ }
}
return true
}
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index 528062b..22d8636 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -47,6 +47,8 @@ enum L10n {
"Run Windows Program…": "Lancer un programme Windows…",
"— or drop any .exe or .msi on this window": "— ou déposez un .exe ou .msi sur cette fenêtre",
"Choose a Windows program": "Choisir un programme Windows",
+ "'%@' isn't a Windows program. You can drop .exe, .msi or .bat files here.":
+ "« %@ » n'est pas un programme Windows. Vous pouvez déposer des fichiers .exe, .msi ou .bat ici.",
"Installed": "Installée",
"Windows runtimes some games need. Install them when a game complains about a missing runtime or refuses to start.":
"Des composants Windows dont certains jeux ont besoin. Installez-les quand un jeu se plaint d'un composant manquant ou refuse de démarrer.",