From 45d145a950d0cc7b6c117ad3fff4159ec6a7fe14 Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Fri, 29 May 2026 09:40:06 +0200 Subject: [PATCH] Prefer larger files over shallow depth in findMainExe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Size is a better indicator of 'this is the actual game' than depth. A 1MB+ FALLOUT.EXE in a subdirectory should beat a 50KB BOOTME.EXE at the root. Sort order: non-installer → DOS → size → depth. --- src/main/java/com/dostalgia/UploadResource.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/dostalgia/UploadResource.java b/src/main/java/com/dostalgia/UploadResource.java index 67374f8..2331837 100644 --- a/src/main/java/com/dostalgia/UploadResource.java +++ b/src/main/java/com/dostalgia/UploadResource.java @@ -261,7 +261,7 @@ public class UploadResource { if (candidates.isEmpty()) return null; - // Prefer: non-installer → DOS platform → shallow depth → larger file + // Prefer: non-installer → DOS platform → larger file → shallow depth candidates.sort(Comparator .comparingInt((Candidate c) -> c.isInstaller() ? 1 : 0) .thenComparingInt(c -> { @@ -270,8 +270,8 @@ public class UploadResource { if (c.platform() == null) return 1; return 2; // "windows" }) - .thenComparingInt(Candidate::depth) - .thenComparingLong(c -> -c.size())); + .thenComparingLong(c -> -c.size()) + .thenComparingInt(Candidate::depth)); return candidates.getFirst().path(); }