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:
@@ -584,28 +584,10 @@ public class UploadResource {
|
||||
sb.append("[autoexec]\n");
|
||||
sb.append("@echo off\n");
|
||||
sb.append("mount c .\n");
|
||||
// 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<>();
|
||||
// Mount CD images as D:, E:, … so games can find their CD
|
||||
char driveLetter = 'D';
|
||||
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();
|
||||
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";
|
||||
sb.append("imgmount ").append(driveLetter).append(" \"").append(img).append("\"").append(flags).append("\n");
|
||||
driveLetter++;
|
||||
|
||||
Reference in New Issue
Block a user