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
GOG installs in a Games folder that is a symlink turn to Play. FileManager lists nothing for a link, so a GOG game downloaded into drive_c/Games pointing at an external drive never showed as installed (highball#600), while Epic, which reads legendary's record, worked. Each install root is listed where it points, and games keep their path under the root. A test covers it.
Gauthier Piarrette45fdfc07b08f
diff --git a/Sources/HighballKit/GOGLibrary.swift b/Sources/HighballKit/GOGLibrary.swiftindex 79564cf..5e5fa14 100644--- a/Sources/HighballKit/GOGLibrary.swift+++ b/Sources/HighballKit/GOGLibrary.swift@@ -215,12 +215,16 @@ extension GOGStore {/// Every GOG game installed in the environment: a folder directly under an install root that/// holds goggame-<id>.info files. The base game is the file whose id is its own root id; the/// others are its DLC. A folder gogdl is still downloading into (.gogdl-resume) is skipped.+ /// A root that is a symlink, such as Games moved to an external drive, is listed where it+ /// points, which FileManager doesn't do for a link: those installs never turned to Play+ /// (highball#600). Games keep their path under the root.public static func installedGames(driveC: URL) -> [InstalledGame] {let fm = FileManager.defaultvar games: [InstalledGame] = []for root in installRoots(driveC: driveC) {- let folders = (try? fm.contentsOfDirectory(at: root, includingPropertiesForKeys: [.isDirectoryKey], options: [.skipsHiddenFiles])) ?? []- for folder in folders where (try? folder.resourceValues(forKeys: [.isDirectoryKey]).isDirectory) == true {+ let found = (try? fm.contentsOfDirectory(at: root.resolvingSymlinksInPath(), includingPropertiesForKeys: [.isDirectoryKey], options: [.skipsHiddenFiles])) ?? []+ for entry in found where (try? entry.resourceValues(forKeys: [.isDirectoryKey]).isDirectory) == true {+ let folder = root.appending(path: entry.lastPathComponent, directoryHint: .isDirectory)if fm.fileExists(atPath: folder.appending(path: ".gogdl-resume").path) { continue }if let game = installedGame(in: folder) { games.append(game) }}diff --git a/Tests/HighballKitTests/GOGStoreTests.swift b/Tests/HighballKitTests/GOGStoreTests.swiftindex 8a4bcdf..c12b419 100644--- a/Tests/HighballKitTests/GOGStoreTests.swift+++ b/Tests/HighballKitTests/GOGStoreTests.swift@@ -142,6 +142,22 @@ final class GOGStoreTests: XCTestCase {return dir}+ /// highball#600: Games is a symlink to a folder on an external drive. The install is found,+ /// and its folder stays under the environment's Games.+ func testGamesFolderThatIsASymlinkIsListed() throws {+ let top = FileManager.default.temporaryDirectory.appending(path: "gog-\(UUID().uuidString)")+ defer { try? FileManager.default.removeItem(at: top) }+ let driveC = top.appending(path: "drive_c"), external = top.appending(path: "external/Games")+ try FileManager.default.createDirectory(at: driveC, withIntermediateDirectories: true)+ _ = try makeGame(external, folder: "Ghostrunner", infos: [+ "goggame-1957528513.info": #"{"gameId":"1957528513","rootGameId":"1957528513","name":"Ghostrunner"}"#,+ ])+ try FileManager.default.createSymbolicLink(at: driveC.appending(path: "Games"), withDestinationURL: external)+ let games = GOGStore.installedGames(driveC: driveC)+ XCTAssertEqual(games.map(\.id), ["1957528513"])+ XCTAssertEqual(games.first?.folder.path, driveC.appending(path: "Games/Ghostrunner").path)+ }+/// Ghostrunner as gogdl installed it, with its DLC's info file beside the game's, and Control/// from an offline installer in GOG's default folder: both found, with the DLC attached.func testInstalledGamesComeFromInfoFiles() throws {