Add path=c:\ to autoexec for DOS extender findability
Build & Deploy / build-and-deploy (push) Successful in 47s
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:
@@ -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");
|
||||||
|
|||||||
Reference in New Issue
Block a user