Skip to content

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

A game folder that is a symlink is searched for its program: a game moved to another disk and linked back enumerated as empty, so it had no icon, no per-program settings and no Direct3D 12 check (Forza Horizon 6 in a test environment, 0.10.9 release pass, 2026-10-06). The walk runs in the resolved folder and the program is named under the folder the environment uses

Gauthier Piarrette643ce6fec039
diff --git a/Sources/HighballKit/PEIcon.swift b/Sources/HighballKit/PEIcon.swift
index df0c8c3..b863731 100644
--- a/Sources/HighballKit/PEIcon.swift
+++ b/Sources/HighballKit/PEIcon.swift
@@ -29,7 +29,13 @@ public enum PEIcon {
static func bestExecutable(in dir: URL, maxLevel: Int) -> URL? {
let fm = FileManager.default
let excluded = ["unins", "setup", "redist", "crash", "report", "vc_redist", "vcredist", "dxsetup", "dotnet", "directx", "easyanticheat", "installscript", "launcher_", "helper"]
- guard let e = fm.enumerator(at: dir, includingPropertiesForKeys: [.fileSizeKey, .isRegularFileKey], options: [.skipsHiddenFiles]) else { return nil }
+ // A game folder that is itself a symlink (a game moved to another disk and linked back)
+ // enumerates as empty, so nothing was found for it: no icon, no per-program settings, no
+ // Direct3D 12 check (the 0.10.9 release pass, 2026-10-06, where Forza Horizon 6's folder in
+ // a test environment was a link). The walk runs in the resolved folder, and the program is
+ // named under the folder the caller gave, the path the environment itself uses.
+ let root = dir.resolvingSymlinksInPath()
+ guard let e = fm.enumerator(at: root, includingPropertiesForKeys: [.fileSizeKey, .isRegularFileKey], options: [.skipsHiddenFiles]) else { return nil }
var best: (URL, Int)?
for case let url as URL in e {
if e.level > maxLevel { e.skipDescendants(); continue }
@@ -39,7 +45,10 @@ public enum PEIcon {
let size = (try? url.resourceValues(forKeys: [.fileSizeKey]).fileSize) ?? 0
if best == nil || size > best!.1 { best = (url, size) }
}
- return best?.0
+ guard let found = best?.0 else { return nil }
+ let base = root.standardizedFileURL.path, path = found.resolvingSymlinksInPath().standardizedFileURL.path
+ guard root != dir, path.hasPrefix(base + "/") else { return found }
+ return dir.appending(path: String(path.dropFirst(base.count + 1)))
}
// MARK: PE resources
diff --git a/Tests/HighballKitTests/PEIconTests.swift b/Tests/HighballKitTests/PEIconTests.swift
index ad4b89c..27495ac 100644
--- a/Tests/HighballKitTests/PEIconTests.swift
+++ b/Tests/HighballKitTests/PEIconTests.swift
@@ -54,6 +54,26 @@ final class PEIconTests: XCTestCase {
XCTAssertEqual(PEIcon.bestExecutable(in: dir)?.lastPathComponent, "start.exe")
}
+ /// A game folder that is a symlink (a game moved to another disk and linked back) used to
+ /// enumerate as empty, so the program was never found (0.10.9 release pass, 2026-10-06).
+ func testAProgramIsFoundThroughASymlinkedGameFolderAndNamedUnderIt() throws {
+ let base = FileManager.default.temporaryDirectory.appending(path: "hb-exe-\(UUID().uuidString)")
+ defer { try? FileManager.default.removeItem(at: base) }
+ let real = base.appending(path: "elsewhere/ForzaHorizon6")
+ try FileManager.default.createDirectory(at: real.appending(path: "bin"), withIntermediateDirectories: true)
+ try Data(count: 3000).write(to: real.appending(path: "bin/game.exe"))
+ try Data(count: 10).write(to: real.appending(path: "tool.exe"))
+ let common = base.appending(path: "steamapps/common")
+ try FileManager.default.createDirectory(at: common, withIntermediateDirectories: true)
+ let link = common.appending(path: "ForzaHorizon6")
+ try FileManager.default.createSymbolicLink(at: link, withDestinationURL: real)
+ let found = try XCTUnwrap(PEIcon.bestExecutable(in: link), "nothing found through the link")
+ XCTAssertEqual(found.path, link.appending(path: "bin/game.exe").path, "named under the folder the caller gave")
+ XCTAssertTrue(FileManager.default.fileExists(atPath: found.path))
+ // A plain folder is unchanged.
+ XCTAssertEqual(PEIcon.bestExecutable(in: real)?.path, real.appending(path: "bin/game.exe").path)
+ }
+
func testARealProgramOnThisMacWhenThereIsOne() throws {
let candidates = [
"Library/Application Support/Highball/bottles/Gaming/drive_c/highball/ahk/AutoHotkeyU64.exe",