fix: seenDirs.add() after descriptor check, not before
Build & Deploy / build-and-deploy (push) Failing after 39s
Build & Deploy / build-and-deploy (push) Failing after 39s
The bug: seenDirs.add(parentDir) was called BEFORE the descriptor-skip check. When .ccd was processed first, it marked cd/ as seen even though it was skipped. Then .img was skipped because cd/ was already 'seen', leaving zero imgmount lines. Fix: use seenDirs.contains(parentDir) for the continue check, and call seenDirs.add(parentDir) only after passing all checks, right before the actual imgmount output.
This commit is contained in:
@@ -243,7 +243,7 @@ public class GameService {
|
||||
for (String img : cdImages) {
|
||||
int slashIdx = img.lastIndexOf('/');
|
||||
String parentDir = slashIdx >= 0 ? img.substring(0, slashIdx) : "";
|
||||
if (!seenDirs.add(parentDir)) continue;
|
||||
if (seenDirs.contains(parentDir)) continue;
|
||||
String imgLower = img.toLowerCase();
|
||||
// Skip descriptor formats if a data format exists in the same directory
|
||||
if (imgLower.endsWith(".cue") || imgLower.endsWith(".ccd")) {
|
||||
@@ -256,6 +256,7 @@ public class GameService {
|
||||
});
|
||||
if (hasData) continue;
|
||||
}
|
||||
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++;
|
||||
|
||||
@@ -579,7 +579,7 @@ public class UploadResource {
|
||||
for (String img : cdImages) {
|
||||
int slashIdx = img.lastIndexOf('/');
|
||||
String parentDir = slashIdx >= 0 ? img.substring(0, slashIdx) : "";
|
||||
if (!seenDirs.add(parentDir)) continue;
|
||||
if (seenDirs.contains(parentDir)) continue;
|
||||
String imgLower = img.toLowerCase();
|
||||
// Skip descriptor formats if a data format exists in the same directory
|
||||
if (imgLower.endsWith(".cue") || imgLower.endsWith(".ccd")) {
|
||||
@@ -592,6 +592,8 @@ public class UploadResource {
|
||||
});
|
||||
if (hasData) continue;
|
||||
}
|
||||
seenDirs.add(parentDir);
|
||||
String imgLower = img.toLowerCase();
|
||||
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++;
|
||||
@@ -599,11 +601,6 @@ public class UploadResource {
|
||||
// Present a DOS prompt — the game runs from the CD
|
||||
sb.append("c:\n");
|
||||
sb.append("echo.\n");
|
||||
sb.append("echo [debug] cdImages found: ").append(cdImages.size()).append("\n");
|
||||
for (String img : cdImages) {
|
||||
sb.append("echo - ").append(img).append("\n");
|
||||
}
|
||||
sb.append("echo.\n");
|
||||
sb.append("echo This game runs from the CD-ROM.\n");
|
||||
sb.append("echo Type D: and press Enter, then look for the game executable (e.g. DOTT.EXE).\n");
|
||||
return sb.toString();
|
||||
@@ -662,7 +659,7 @@ public class UploadResource {
|
||||
for (String img : cdImages) {
|
||||
int slashIdx = img.lastIndexOf('/');
|
||||
String parentDir = slashIdx >= 0 ? img.substring(0, slashIdx) : "";
|
||||
if (!seenDirs.add(parentDir)) continue; // already mounted from this dir
|
||||
if (seenDirs.contains(parentDir)) continue;
|
||||
String imgLower = img.toLowerCase();
|
||||
// Skip descriptor formats if a data format exists in the same directory
|
||||
if (imgLower.endsWith(".cue") || imgLower.endsWith(".ccd")) {
|
||||
@@ -673,8 +670,9 @@ public class UploadResource {
|
||||
return ip.equals(parentDir)
|
||||
&& (il.endsWith(".img") || il.endsWith(".iso") || il.endsWith(".bin"));
|
||||
});
|
||||
if (hasData) continue; // data file will be mounted instead (lower in list)
|
||||
if (hasData) continue;
|
||||
}
|
||||
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