Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
A program whose file is gone is not installed: the Installed filter hides it and its tile shows a warning instead of a download arrow (highball#269, a program on an unplugged drive kept listing)
Gauthier Piarrette1c86ac770d8f
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex ad1d815..f7445b5 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -249,7 +249,11 @@ final class AppState {libraryItems = LibraryIndex.build(bottles: bottles, steamByBottle: gamesByBottle,steamOwnedByBottle: steamOwnedByBottle, macInstalled: macSteamGames,epicOwned: epicOwned, epicInstalls: epicInstalls,- plays: libraryPlays, defaultBottle: defaultBottle?.name)+ plays: libraryPlays, defaultBottle: defaultBottle?.name,+ pinExists: { bottle, pin in+ // follows links, so a link to a file that is gone counts as missing+ FileManager.default.fileExists(atPath: pin.executableURL(driveC: bottle.driveC).path)+ })sortLibraryByDisplayTitle()if let deferred = deferredPlayLink { resolvePlayLink(deferred.request) }refreshMacFlags()diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swiftindex d9aea6d..2232a51 100644--- a/Sources/HighballApp/L10n.swift+++ b/Sources/HighballApp/L10n.swift@@ -522,6 +522,7 @@ enum L10n {// An environment that already fits a game's engine, and the windows Highball brings forward (highball-db#318, highball#264)"%d installed": "%d installés","Play there": "Y jouer",+ "This program's file isn't there. Plug in the drive it is on, or remove it from the environment's programs.": "Le fichier de ce programme est introuvable. Branchez le disque où il se trouve, ou retirez-le des programmes de l'environnement.","Use '%@'": "Utiliser « %@ »","'%@' is already on the %@ engine and has the game installed, so it plays there. This environment stays as it is.": "« %@ » utilise déjà le moteur %@ et le jeu y est installé, il s'y lance donc. Cet environnement reste tel quel.","'%@' is already on the %@ engine. Using it installs the game there, with what it needs, and this environment stays as it is.": "« %@ » utilise déjà le moteur %@. L'utiliser y installe le jeu, avec ce qu'il lui faut, et cet environnement reste tel quel.",diff --git a/Sources/HighballApp/LibraryView.swift b/Sources/HighballApp/LibraryView.swiftindex 74010f5..586aa48 100644--- a/Sources/HighballApp/LibraryView.swift+++ b/Sources/HighballApp/LibraryView.swift@@ -262,10 +262,19 @@ struct LibraryTile: View {.padding(6)}if !item.installedAnywhere {- Image(systemName: "arrow.down.circle.fill")- .foregroundStyle(.white.opacity(0.85))- .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topTrailing)- .padding(6)+ // A program you added whose file is gone has nothing to download: say so+ // instead (highball#269).+ Group {+ if item.source == .pin {+ Image(systemName: "exclamationmark.triangle.fill")+ .help(L("This program's file isn't there. Plug in the drive it is on, or remove it from the environment's programs."))+ } else {+ Image(systemName: "arrow.down.circle.fill")+ }+ }+ .foregroundStyle(.white.opacity(0.85))+ .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .topTrailing)+ .padding(6)}// The visible Play of the Home row, bottom right, clear of the badge and of// the Running pill. The hover overlay above takes over while the pointer is in.diff --git a/Sources/HighballKit/Library.swift b/Sources/HighballKit/Library.swiftindex 95c241a..ccf2964 100644--- a/Sources/HighballKit/Library.swift+++ b/Sources/HighballKit/Library.swift@@ -102,7 +102,8 @@ public enum LibraryIndex {epicOwned: [EpicStore.Game],epicInstalls: [String: String],plays: [String: LibraryStore.PlayRecord] = [:],- defaultBottle: String? = nil) -> [LibraryItem] {+ defaultBottle: String? = nil,+ pinExists: (Bottle, Pin) -> Bool = { _, _ in true }) -> [LibraryItem] {var items: [LibraryItem] = []let onMac = Dictionary(macInstalled.map { ($0.appid, $0) }, uniquingKeysWith: { a, _ in a })// Where a game with no other reason to live somewhere goes: the default environment first,@@ -183,13 +184,16 @@ public enum LibraryIndex {lastPlayed: plays[id]?.lastPlayedAt))}- // Custom pins (dropped exes, preinstalled games) — always installed, no artwork.+ // Custom pins (dropped exes, preinstalled games), no artwork. Installed when the program's+ // file is there: one on a drive that is unplugged, or deleted since, is not (highball#269,+ // the Installed filter kept listing them). `pinExists` is the app's check of the disk;+ // without one every pin counts, so the index stays testable without a filesystem.for bottle in bottles {for pin in bottle.settings.pins where !isLauncherPin(pin) {let id = "pin:\(bottle.name):\(pin.id.uuidString)"items.append(LibraryItem(source: .pin, id: id, title: pin.name, bottleName: bottle.name,- installed: true, pinID: pin.id,+ installed: pinExists(bottle, pin), pinID: pin.id,lastPlayed: plays[id]?.lastPlayedAt))}}diff --git a/Tests/HighballKitTests/EnvironmentCopiesTests.swift b/Tests/HighballKitTests/EnvironmentCopiesTests.swiftindex f0b051f..293bc1b 100644--- a/Tests/HighballKitTests/EnvironmentCopiesTests.swift+++ b/Tests/HighballKitTests/EnvironmentCopiesTests.swift@@ -97,4 +97,19 @@ final class EnvironmentCopiesTests: XCTestCase {let first = EnvironmentFit.Candidate(name: "A", holdsGame: false, hasFix: true)XCTAssertEqual(EnvironmentFit.best([first, fix])?.name, "A", "ties keep the app's order")}++ // MARK: A program whose file is gone++ func testAProgramWhoseFileIsGoneIsNotInstalled() {+ var games = bottle("Games")+ let here = Pin(name: "Here", path: "Games/here.exe")+ let gone = Pin(name: "GTA V", path: "/Volumes/MEDIA_DEV/roms/windows/Grand Theft Auto V.pc/PlayGTAV.exe")+ games.settings.pins = [here, gone]+ let items = LibraryIndex.build(bottles: [games], steamByBottle: [:], epicOwned: [], epicInstalls: [:],+ pinExists: { _, pin in pin.id == here.id })+ XCTAssertEqual(items.first { $0.pinID == here.id }?.installed, true)+ XCTAssertEqual(items.first { $0.pinID == gone.id }?.installed, false, "the Installed filter hides it (highball#269)")+ let unchecked = LibraryIndex.build(bottles: [games], steamByBottle: [:], epicOwned: [], epicInstalls: [:])+ XCTAssertTrue(unchecked.filter { $0.source == .pin }.allSatisfy(\.installed), "without a check every program counts, as before")+ }}