Skip to content

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

Add games opens Steam when it is already installed

Gauthier Piarrettef92b1784b558
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index a5e7d53..93b8982 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -644,6 +644,10 @@ final class AppState {
func installSteam() {
guard let bottle = defaultBottle else { makeDefaultEnvironment(); return }
let steam = bottle.driveC.appending(path: "Program Files (x86)/Steam/steam.exe")
+ if steamInstalled(in: bottle) { // already there: open it, never run the installer again
+ launch(pin: Pin(name: "Steam", path: Pin.storagePath(for: steam, driveC: bottle.driveC)), in: bottle)
+ return
+ }
applyRecipe("steam", to: bottle, then: DoneState(
title: L("Steam is installed"), ctaTitle: L("Open Steam"),
cta: { [weak self] in
@@ -652,6 +656,10 @@ final class AppState {
}))
}
+ func steamInstalled(in bottle: Bottle) -> Bool {
+ FileManager.default.fileExists(atPath: bottle.driveC.appending(path: "Program Files (x86)/Steam/steam.exe").path)
+ }
+
/// A game the row says needs D3DMetal, on an engine where it is not enabled yet: Play asks
/// once, in context, with the consequence from the row (UX plan §3.5, canvas "Asked in
/// context"). Nothing downloads; the files are in the engine and accepting flips the flag.
diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swift
index 12b04ae..7282fbc 100644
--- a/Sources/HighballApp/HighballApp.swift
+++ b/Sources/HighballApp/HighballApp.swift
@@ -123,7 +123,7 @@ struct ContentView: View {
.toolbar {
ToolbarItem(placement: .primaryAction) {
Menu {
- Button(L("Install Steam")) { state.installSteam() }
+ Button(state.defaultBottle.map(state.steamInstalled) == true ? L("Open Steam") : L("Install Steam")) { state.installSteam() }
Button(L("Connect Epic account…")) { state.showEpicSignIn = true }
Divider()
ForEach(BottleView.launcherMeta.filter { $0.id != "steam" }, id: \.id) { meta in
diff --git a/Sources/HighballApp/LibraryView.swift b/Sources/HighballApp/LibraryView.swift
index 59b93fb..21b60dc 100644
--- a/Sources/HighballApp/LibraryView.swift
+++ b/Sources/HighballApp/LibraryView.swift
@@ -137,7 +137,7 @@ struct LibraryView: View {
text: L("An installer or game from your Mac. Or drop it onto this window."),
button: L("Choose a file…")) { state.chooseProgramToRun() }
}
- Text(L("Battle.net, GOG Galaxy, the EA app, Ubisoft Connect and Rockstar are on the environment's page."))
+ Text(L("Battle.net, GOG Galaxy, the EA app, Ubisoft Connect and Rockstar are under Add games."))
.font(.caption).foregroundStyle(.tertiary)
}
.frame(maxWidth: .infinity)