fix: prefer .exe/.com over .bat in setup executable detection
Build & Deploy / build-and-deploy (push) Failing after 1m3s

When a game has both SETUP.BAT and SETUP.EXE, the sort comparator
was picking SETUP.BAT (smaller file size) over SETUP.EXE. Batch
files often contain 'win SETUP.EXE' to launch Windows-first — which
fails in DOSBox since WIN.COM isn't available.

Now .exe and .com files are sorted before .bat files at the same
directory depth, so the actual DOS setup utility is preferred.
This commit is contained in:
Hermes Agent
2026-06-11 12:14:07 +02:00
parent e98715ff6d
commit 6a18020c9f
@@ -105,7 +105,13 @@ public class ExecutableDetector {
});
if (candidates.isEmpty()) return null;
candidates.sort(Comparator.comparingInt(Candidate::depth).thenComparingLong(Candidate::size));
candidates.sort(Comparator
.<Candidate, Integer>comparingInt(c -> {
String n = c.path().toLowerCase();
return n.endsWith(".bat") ? 1 : 0; // prefer .exe/.com over .bat
})
.thenComparingInt(Candidate::depth)
.thenComparingLong(Candidate::size));
return candidates.getFirst().path();
}