fix: prefer .exe/.com over .bat in setup executable detection
Build & Deploy / build-and-deploy (push) Failing after 1m3s
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:
@@ -105,7 +105,13 @@ public class ExecutableDetector {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (candidates.isEmpty()) return null;
|
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();
|
return candidates.getFirst().path();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user