simplify: mount all CD images, no dedup
Build & Deploy / build-and-deploy (push) Successful in 38s

Removed the directory-level dedup and .bin-over-.cue preference
logic — it was causing imgmount lines to disappear entirely.

Now mounts every detected CD image (.iso/.cue/.img/.ccd/.bin)
with appropriate flags (.bin gets -fs iso for direct fs access).
This commit is contained in:
Hermes Agent
2026-06-03 09:59:32 +02:00
parent de9e978e55
commit 3b7c9b587f
@@ -584,28 +584,10 @@ public class UploadResource {
sb.append("[autoexec]\n"); sb.append("[autoexec]\n");
sb.append("@echo off\n"); sb.append("@echo off\n");
sb.append("mount c .\n"); sb.append("mount c .\n");
// Mount CD images as D:, E:, … so games can find their CD. // Mount CD images as D:, E:, … so games can find their CD
// Prefer .bin over .cue from the same directory to avoid case-mismatch
// between the .cue's internal FILE reference and the actual filename.
// .bin files are mounted with -fs iso for direct filesystem access.
Set<String> seenDirs = new java.util.HashSet<>();
char driveLetter = 'D'; char driveLetter = 'D';
for (String img : cdImages) { for (String img : cdImages) {
// Deduplicate by directory — prefer .bin over .cue
int slashIdx = img.lastIndexOf('/');
String parentDir = slashIdx >= 0 ? img.substring(0, slashIdx) : "";
String imgLower = img.toLowerCase(); String imgLower = img.toLowerCase();
if (seenDirs.contains(parentDir)) continue;
if (imgLower.endsWith(".cue")) {
// Check if a .bin exists in the same directory
boolean hasBin = cdImages.stream().anyMatch(i -> {
int is = i.lastIndexOf('/');
String ip = is >= 0 ? i.substring(0, is) : "";
return ip.equals(parentDir) && i.toLowerCase().endsWith(".bin");
});
if (hasBin) continue; // .bin will be mounted instead (lower in list)
}
seenDirs.add(parentDir);
String flags = imgLower.endsWith(".bin") ? " -t cdrom -fs iso" : " -t cdrom"; String flags = imgLower.endsWith(".bin") ? " -t cdrom -fs iso" : " -t cdrom";
sb.append("imgmount ").append(driveLetter).append(" \"").append(img).append("\"").append(flags).append("\n"); sb.append("imgmount ").append(driveLetter).append(" \"").append(img).append("\"").append(flags).append("\n");
driveLetter++; driveLetter++;