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
Library keeps up with installs started after launch, and with a rebuilt Steam folder
Gauthier Piarrette375e87f20688
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swiftindex 15ef7d4..1465ad8 100644--- a/Sources/HighballApp/AppState.swift+++ b/Sources/HighballApp/AppState.swift@@ -305,6 +305,9 @@ final class AppState {/// so it must not spawn per call beyond legendary's install list, and never touches the/// directories it watches.func refreshInstalledGames() {+ // Re-arm first: a steamapps that did not exist at the last full refresh (Steam was+ // installed after launch) is only watched from here on, and a replaced one is reopened.+ installWatcher?.watch(bottles.flatMap(installDirectories))let games = Dictionary(bottles.map { ($0.name, SteamLibrary.games(in: $0)) }, uniquingKeysWith: { a, _ in a })if games != gamesByBottle { gamesByBottle = games; rebuildLibrary() }guard epicSignedIn, !epicFetchInFlight else { return }diff --git a/Sources/HighballKit/DirectoryWatcher.swift b/Sources/HighballKit/DirectoryWatcher.swiftindex 86d0b1a..500d818 100644--- a/Sources/HighballKit/DirectoryWatcher.swift+++ b/Sources/HighballKit/DirectoryWatcher.swift@@ -31,6 +31,16 @@ public final class DirectoryWatcher {source.cancel()sources[path] = nil}+ // A watched directory that was deleted and recreated (Steam's first update rebuilds+ // its folders) leaves the source on the old inode, where nothing ever happens again:+ // the library then misses every later install until a relaunch. Compare inodes and+ // reopen such a source.+ for (path, source) in sources where wanted.contains(path) {+ var onDisk = stat(), held = stat()+ let same = stat(path, &onDisk) == 0 && fstat(Int32(source.handle), &held) == 0+ && onDisk.st_ino == held.st_ino && onDisk.st_dev == held.st_dev+ if !same { source.cancel(); sources[path] = nil }+ }for path in wanted where sources[path] == nil {let fd = open(path, O_EVTONLY)guard fd >= 0 else { continue }diff --git a/Tests/HighballKitTests/DirectoryWatcherTests.swift b/Tests/HighballKitTests/DirectoryWatcherTests.swiftindex ec6fed8..0497d75 100644--- a/Tests/HighballKitTests/DirectoryWatcherTests.swift+++ b/Tests/HighballKitTests/DirectoryWatcherTests.swift@@ -28,4 +28,48 @@ final class DirectoryWatcherTests: XCTestCase {watcher.watch([])XCTAssertTrue(watcher.watched.isEmpty)}++ /// Steam's install folder appears after the app started (the Steam recipe ran from Get Started),+ /// so it is not there at the first watch; the next watch must arm it (issue found in the+ /// 2026-09-05 from-scratch run: an installed game did not appear until a relaunch).+ func testDirectoryCreatedAfterTheFirstWatchIsArmedByTheNextWatch() throws {+ let root = FileManager.default.temporaryDirectory.appending(path: "watch-\(UUID().uuidString)")+ try FileManager.default.createDirectory(at: root, withIntermediateDirectories: true)+ defer { try? FileManager.default.removeItem(at: root) }+ let steamapps = root.appending(path: "steamapps")+ let changed = expectation(description: "change reported after arming")+ let watcher = DirectoryWatcher(quiet: 0.2) { changed.fulfill() }+ watcher.watch([steamapps])+ XCTAssertTrue(watcher.watched.isEmpty)+ try FileManager.default.createDirectory(at: steamapps, withIntermediateDirectories: true)+ watcher.watch([steamapps])+ XCTAssertEqual(watcher.watched, [steamapps.path])+ FileManager.default.createFile(atPath: steamapps.appending(path: "appmanifest_400.acf").path, contents: Data("x".utf8))+ wait(for: [changed], timeout: 5)+ withExtendedLifetime(watcher) {}+ }++ /// A watched directory that is deleted and recreated (Steam's first update rebuilds folders)+ /// leaves a source on the old inode where nothing happens again; the next watch must reopen it.+ func testReplacedDirectoryIsReopened() throws {+ let root = FileManager.default.temporaryDirectory.appending(path: "watch-\(UUID().uuidString)")+ let dir = root.appending(path: "steamapps")+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)+ defer { try? FileManager.default.removeItem(at: root) }+ var onReport: () -> Void = {}+ let watcher = DirectoryWatcher(quiet: 0.2) { onReport() }+ watcher.watch([dir])+ // The delete is reported on its own; wait it out so it cannot coalesce with the next write.+ let deleted = expectation(description: "delete reported")+ onReport = { deleted.fulfill() }+ try FileManager.default.removeItem(at: dir)+ wait(for: [deleted], timeout: 5)+ try FileManager.default.createDirectory(at: dir, withIntermediateDirectories: true)+ watcher.watch([dir]) // must reopen on the new inode+ let written = expectation(description: "write on the recreated directory reported")+ onReport = { written.fulfill() }+ FileManager.default.createFile(atPath: dir.appending(path: "appmanifest_620.acf").path, contents: Data("y".utf8))+ wait(for: [written], timeout: 5) // only if the new inode is watched+ withExtendedLifetime(watcher) {}+ }}