Skip to content

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

Fix the 0.8.0 regression: creating an environment is never silent

Gauthier Piarrette56235275b3bf
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index d2535ec..74a94b7 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -632,7 +632,10 @@ final class AppState {
/// Makes the default environment for a Mac that has the engine but no bottle yet.
func makeDefaultEnvironment() {
- guard let engine = defaultEngine else { return }
+ guard let engine = defaultEngine else {
+ fail(HighballError.failed("No engine is installed yet. Restart Highball to finish setup.")); return
+ }
+ guard !busy else { return } // already preparing; the strip shows it
runBusy(L("Preparing your Windows environment"), expected: L("about 90 seconds"),
done: DoneState(title: L("Highball is ready"), ctaTitle: nil, cta: nil)) { [self] in
_ = try await bottleStore.create(name: Self.defaultEnvironmentName, engine: engine)
@@ -704,7 +707,12 @@ final class AppState {
}
func createBottle(name: String, recipeID: String?) {
- guard let engine = defaultEngine else { return }
+ guard let engine = defaultEngine else {
+ fail(HighballError.failed("No engine is installed yet. Reinstall Highball, or restart it to finish setup.")); return
+ }
+ guard !busy else {
+ fail(HighballError.failed("Highball is already busy. Wait for the current step to finish, then try again — its progress is on the strip at the bottom of the window.")); return
+ }
runBusy(String(format: L("Creating the %@ environment — first boot takes about 90 seconds"), name),
done: DoneState(title: String(format: L("The %@ environment is ready"), name), ctaTitle: nil, cta: nil),
stop: .cancelTask(label: L("Stop"))) { [self] in
diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swift
index 20370f1..1cf5bec 100644
--- a/Sources/HighballApp/HighballApp.swift
+++ b/Sources/HighballApp/HighballApp.swift
@@ -271,23 +271,23 @@ struct CreateBottleSheet: View {
var body: some View {
VStack(alignment: .leading, spacing: 14) {
- Text(L("New bottle")).font(.title2.bold())
+ Text(L("New environment")).font(.title2.bold())
TextField(L("Name"), text: $name).textFieldStyle(.roundedBorder).frame(width: 260)
if let problem = nameProblem, !name.trimmingCharacters(in: .whitespaces).isEmpty {
Text(L(problem)).font(.caption).foregroundStyle(.orange).frame(maxWidth: 380, alignment: .leading)
}
Toggle(L("Install Steam in it (recommended)"), isOn: $installSteam)
- Text(L("A bottle is an isolated Windows environment. First boot takes about 90 seconds; the Steam install adds a download and a slow one-time client update."))
+ Text(L("An environment is an isolated Windows install. First boot takes about 90 seconds; installing Steam adds a download and a slow one-time client update."))
.font(.callout).foregroundStyle(.secondary).frame(maxWidth: 380, alignment: .leading)
HStack {
Spacer()
Button(L("Cancel")) { dismiss() }
- Button(L("Create")) {
+ Button(state.busy ? L("Working…") : L("Create")) {
dismiss()
state.createBottle(name: name, recipeID: installSteam ? "steam" : nil)
}
.keyboardShortcut(.defaultAction)
- .disabled(nameProblem != nil)
+ .disabled(nameProblem != nil || state.busy)
}
}
.padding(24)
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index c3ed990..23f1a9a 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -403,5 +403,10 @@ enum L10n {
"a large download; you can leave it running": "un gros téléchargement ; vous pouvez le laisser tourner",
"your environment": "votre environnement",
"Use %@": "Utiliser %@",
+ "Working…": "En cours…",
+ "An environment is an isolated Windows install. First boot takes about 90 seconds; installing Steam adds a download and a slow one-time client update.": "Un environnement est une installation Windows isolée. Le premier démarrage prend environ 90 secondes ; installer Steam ajoute un téléchargement et une lente mise à jour unique du client.",
+ "No engine is installed yet. Reinstall Highball, or restart it to finish setup.": "Aucun moteur n'est encore installé. Réinstallez Highball, ou relancez-le pour terminer la configuration.",
+ "Highball is already busy. Wait for the current step to finish, then try again — its progress is on the strip at the bottom of the window.": "Highball est déjà occupé. Attendez la fin de l'étape en cours, puis réessayez — sa progression est affichée en bas de la fenêtre.",
+ "No engine is installed yet. Restart Highball to finish setup.": "Aucun moteur n'est encore installé. Relancez Highball pour terminer la configuration.",
]
}
diff --git a/Tests/HighballKitTests/LibraryUpgradeTests.swift b/Tests/HighballKitTests/LibraryUpgradeTests.swift
new file mode 100644
index 0000000..6dfef74
--- /dev/null
+++ b/Tests/HighballKitTests/LibraryUpgradeTests.swift
@@ -0,0 +1,33 @@
+import XCTest
+@testable import HighballKit
+
+/// The 0.8 sidebar removal must never hide an existing user's games: the library is built from
+/// every environment, whatever it is named (regression for issue #21's "can't see my bottle").
+final class LibraryUpgradeTests: XCTestCase {
+ private func bottle(_ name: String) -> Bottle {
+ Bottle(url: URL(fileURLWithPath: "/tmp/\(name)"), settings: BottleSettings(name: name, engineID: "e"))
+ }
+
+ func testGamesFromAnyNamedEnvironmentAppear() {
+ let cs = bottle("CS") // an upgrader's environment, not the default "Games"
+ let game = SteamGame(appid: 240, name: "Counter-Strike: Source", installdir: "cs", sizeOnDisk: 1, stateFlags: 4, lastPlayed: nil)
+ let items = LibraryIndex.build(bottles: [cs], steamByBottle: ["CS": [game]], epicOwned: [], epicInstalls: [:])
+ XCTAssertEqual(items.count, 1)
+ XCTAssertEqual(items.first?.title, "Counter-Strike: Source")
+ XCTAssertEqual(items.first?.bottleName, "CS")
+ XCTAssertTrue(items.first?.installed == true)
+ }
+
+ func testTwoEnvironmentsBothContributeAndTheSameGameMerges() {
+ let a = bottle("CS"), b = bottle("Modding")
+ let g1 = SteamGame(appid: 730, name: "CS2", installdir: "cs2", sizeOnDisk: 1, stateFlags: 4, lastPlayed: nil)
+ let g2 = SteamGame(appid: 620, name: "Portal 2", installdir: "p2", sizeOnDisk: 1, stateFlags: 4, lastPlayed: nil)
+ let items = LibraryIndex.build(bottles: [a, b],
+ steamByBottle: ["CS": [g1], "Modding": [g1, g2]],
+ epicOwned: [], epicInstalls: [:])
+ XCTAssertEqual(Set(items.map(\.title)), ["CS2", "Portal 2"])
+ // The duplicated CS2 is one row that remembers the other environment.
+ let cs2 = items.first { $0.title == "CS2" }
+ XCTAssertFalse(cs2?.otherBottles.isEmpty ?? true)
+ }
+}