Skip to content

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

game page: Show the game's folder (discussion #126), the install folder for Steam, Epic and pinned programs, next to Show the Windows drive; programExecutable resolves through the same programFolder

Gauthier Piarrette4b8441ba599c
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 94dcdd8..a9c8c93 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -1140,14 +1140,32 @@ final class AppState {
private func findProgramExecutable(for item: LibraryItem) -> URL? {
guard let bottleName = item.bottleName, let bottle = bottles.first(where: { $0.name == bottleName }) else { return nil }
switch item.source {
+ case .steam, .epic:
+ return programFolder(for: item).flatMap { PEIcon.bestExecutable(in: $0) }
+ case .pin:
+ return item.pinID.flatMap { id in bottle.settings.pins.first { $0.id == id } }.map { $0.executableURL(driveC: bottle.driveC) }
+ }
+ }
+
+ /// The game's own folder on disk: Steam's install directory, Epic's install path, or the
+ /// directory a pinned program lives in. What "Show the game's folder" opens (discussion
+ /// #126: mods are folder copies, and the question was where the game is). Nil when the
+ /// game is not installed here.
+ func programFolder(for item: LibraryItem) -> URL? {
+ guard let bottleName = item.bottleName, let bottle = bottles.first(where: { $0.name == bottleName }) else { return nil }
+ let folder: URL?
+ switch item.source {
case .steam:
guard let game = gamesByBottle[bottleName]?.first(where: { $0.appid == item.steamAppID }), !game.installdir.isEmpty else { return nil }
- return PEIcon.bestExecutable(in: bottle.driveC.appending(path: "Program Files (x86)/Steam/steamapps/common/\(game.installdir)"))
+ folder = bottle.driveC.appending(path: "Program Files (x86)/Steam/steamapps/common/\(game.installdir)", directoryHint: .isDirectory)
case .epic:
- return item.epicAppName.flatMap { epicInstalls[$0] }.flatMap { PEIcon.bestExecutable(in: URL(fileURLWithPath: $0)) }
+ folder = item.epicAppName.flatMap { epicInstalls[$0] }.map { URL(fileURLWithPath: $0, isDirectory: true) }
case .pin:
- return item.pinID.flatMap { id in bottle.settings.pins.first { $0.id == id } }.map { $0.executableURL(driveC: bottle.driveC) }
+ folder = item.pinID.flatMap { id in bottle.settings.pins.first { $0.id == id } }.map { $0.executableURL(driveC: bottle.driveC).deletingLastPathComponent() }
}
+ guard let folder else { return nil }
+ var isDir: ObjCBool = false
+ return FileManager.default.fileExists(atPath: folder.path, isDirectory: &isDir) && isDir.boolValue ? folder : nil
}
/// Emulated display mode changes for a program (`DisplayModeEmulation`): the bottle's
diff --git a/Sources/HighballApp/GameDetailView.swift b/Sources/HighballApp/GameDetailView.swift
index 29c7a23..25d5f78 100644
--- a/Sources/HighballApp/GameDetailView.swift
+++ b/Sources/HighballApp/GameDetailView.swift
@@ -255,6 +255,10 @@ struct GameDetailView: View {
}
HStack(alignment: .firstTextBaseline, spacing: 12) {
Text(L("Files")).font(.caption).foregroundStyle(.secondary).frame(width: 110, alignment: .leading)
+ if let folder = state.programFolder(for: item) {
+ Button(L("Show the game's folder")) { NSWorkspace.shared.open(folder) }.controlSize(.small)
+ .help(L("Opens the game's own folder in the Finder, where mods and config files go."))
+ }
Button(L("Show the Windows drive")) { NSWorkspace.shared.open(bottle.driveC) }.controlSize(.small)
if MacAppStub.existing(for: item.title) != nil {
Button(L("Remove the shortcut")) { state.removeMacApp(title: item.title) }.controlSize(.small)
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index 4fe85ce..6b186fd 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -470,6 +470,8 @@ enum L10n {
"Delete this environment? Its Windows drive and everything installed in it are removed.": "Supprimer cet environnement ? Son disque Windows et tout ce qui y est installé seront supprimés.",
"Delete this environment? Its Windows drive and everything installed in it are removed, including the game saves kept in its Documents folder.": "Supprimer cet environnement ? Son disque Windows et tout ce qui y est installé seront supprimés, y compris les sauvegardes gardées dans son dossier Documents.",
"Keep game files inside this environment": "Garder les fichiers des jeux dans cet environnement",
+ "Show the game's folder": "Afficher le dossier du jeu",
+ "Opens the game's own folder in the Finder, where mods and config files go.": "Ouvre le dossier du jeu dans le Finder, là où vont les mods et les fichiers de configuration.",
"On, the Windows Documents folder lives inside this environment, so games that save there (FromSoftware, Bandai Namco, the Sims and others) no longer write into your Mac's Documents. Files already in your Mac's Documents stay there and the game starts fresh here. Off again keeps the environment's folder as “Documents (environment)”. Saves kept inside go with the environment when you delete it.": "Activé, le dossier Documents de Windows vit dans cet environnement, donc les jeux qui y sauvegardent (FromSoftware, Bandai Namco, les Sims et d'autres) n'écrivent plus dans le dossier Documents de votre Mac. Les fichiers déjà dans le Documents du Mac y restent et le jeu repart de zéro ici. Désactivé, le dossier de l'environnement est gardé sous le nom « Documents (environment) ». Les sauvegardes gardées à l'intérieur partent avec l'environnement quand vous le supprimez.",
"Deleting the %@ environment": "Suppression de l'environnement %@",
"Duplicating the %@ environment": "Duplication de l'environnement %@",