Skip to content

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

fix: a Finder-duplicated bottle crashed the app at every launch (#13)

Gauthier Piarrette823b8e0e2559
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 10f300e..6b8c3ae 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -44,7 +44,8 @@ final class AppState {
needsOnboarding = engines.isEmpty
rosettaInstalled = FileManager.default.fileExists(atPath: "/Library/Apple/usr/share/rosetta/rosetta")
if selectedBottle == nil { selectedBottle = bottles.first?.name }
- gamesByBottle = Dictionary(uniqueKeysWithValues: bottles.map { ($0.name, SteamLibrary.games(in: $0)) })
+ // Never trap on duplicate names (a Finder-duplicated bottle crashed the app at launch — issue #13).
+ gamesByBottle = Dictionary(bottles.map { ($0.name, SteamLibrary.games(in: $0)) }, uniquingKeysWith: { a, _ in a })
if gameDB.byAppID.isEmpty {
var dirs: [URL] = []
if let res = Bundle.main.resourceURL { dirs.append(res.appending(path: "db-games")) }
diff --git a/Sources/HighballKit/BottleStore.swift b/Sources/HighballKit/BottleStore.swift
index 572cae3..b007305 100644
--- a/Sources/HighballKit/BottleStore.swift
+++ b/Sources/HighballKit/BottleStore.swift
@@ -7,7 +7,17 @@ public struct BottleStore: Sendable {
public func list() throws -> [Bottle] {
guard FileManager.default.fileExists(atPath: paths.bottles.path) else { return [] }
return try FileManager.default.contentsOfDirectory(at: paths.bottles, includingPropertiesForKeys: nil)
- .compactMap { try? Bottle.load($0) }
+ .compactMap { url -> Bottle? in
+ guard var b = try? Bottle.load(url) else { return nil }
+ // The folder is the bottle's identity (get/delete resolve by folder). A copied
+ // folder keeps the old internal name, which crashed the app and confused lookups
+ // (issue #13) — reconcile so "play copy" is simply a bottle called "play copy".
+ if b.settings.name != url.lastPathComponent {
+ b.settings.name = url.lastPathComponent
+ try? b.save()
+ }
+ return b
+ }
.sorted { $0.name < $1.name }
}