Add path=c:\ to autoexec for DOS extender findability
Build & Deploy / build-and-deploy (push) Successful in 47s

When the main executable is in a subdirectory but DOS4GW.EXE (or other
DOS extender) is at the ZIP root, DOS/4GW fails with 'No such file or
directory' because it only searches the current directory and PATH.
Adding 'path=c:\' before the 'cd' command ensures root-level DOS
extenders are always findable regardless of where the game EXE lives.
This commit is contained in:
Hermes Agent
2026-05-29 10:15:23 +02:00
parent 815247f760
commit e262a46487
@@ -488,15 +488,19 @@ public class UploadResource {
} }
private byte[] buildJsdosJson(String relExe) { private byte[] buildJsdosJson(String relExe) {
// DOS uses \ as path separator; / is a switch character. // DOS uses \\ as path separator; / is a switch character.
// If the executable is in a subdirectory, cd into it first. // If the executable is in a subdirectory, cd into it first.
var parts = splitDirExe(relExe); var parts = splitDirExe(relExe);
String script = parts[0] != null StringBuilder script = new StringBuilder();
? "cd " + parts[0] + "\n" + parts[1] if (parts[0] != null) {
: relExe; // Set PATH to include root so DOS extenders (DOS4GW etc.) are findable
script.append("path=c:\\\n");
script.append("cd ").append(parts[0]).append("\n");
}
script.append(parts[1]);
String json = "{" String json = "{"
+ "\"autoexec\":{" + "\"autoexec\":{"
+ "\"options\":{\"script\":{\"value\":\"" + escapeJson(script) + "\"}}" + "\"options\":{\"script\":{\"value\":\"" + escapeJson(script.toString()) + "\"}}"
+ "}," + "},"
+ "\"output\":{" + "\"output\":{"
+ "\"options\":{\"autolock\":{\"value\":true}}}" + "\"options\":{\"autolock\":{\"value\":true}}}"
@@ -539,8 +543,8 @@ public class UploadResource {
sb.append("@echo off\n"); sb.append("@echo off\n");
sb.append("mount c .\n"); sb.append("mount c .\n");
sb.append("c:\n"); sb.append("c:\n");
sb.append("cls\n");
if (dir != null) { if (dir != null) {
sb.append("path=c:\\\n");
sb.append("cd ").append(dir).append("\n"); sb.append("cd ").append(dir).append("\n");
} }
sb.append(exe).append("\n"); sb.append(exe).append("\n");