fix: use backslash path separator for DOS paths
Build & Deploy / build-and-deploy (push) Successful in 49s

extractDir.relativize() returns paths with native Linux forward
slashes. DOS requires backslashes. Changed .replace('\', '/')
to .replace('/', '\') and updated buildDosboxConf split logic
to also check for backslash separator.
This commit is contained in:
David Alvarez
2026-05-27 10:41:45 +02:00
parent 542db6a916
commit 596b897df6
@@ -88,7 +88,7 @@ public class UploadResource {
// Write dosbox.conf (full config, not just autoexec) // Write dosbox.conf (full config, not just autoexec)
Path jsdos = gameDir.resolve(".jsdos"); Path jsdos = gameDir.resolve(".jsdos");
Files.createDirectories(jsdos); Files.createDirectories(jsdos);
String relExe = extractDir.relativize(Path.of(mainExe)).toString().replace('\\', '/'); String relExe = extractDir.relativize(Path.of(mainExe)).toString().replace('/', '\\');
String conf = buildDosboxConf(relExe); String conf = buildDosboxConf(relExe);
Files.writeString(jsdos.resolve("dosbox.conf"), conf); Files.writeString(jsdos.resolve("dosbox.conf"), conf);
Files.write(jsdos.resolve("jsdos.json"), buildJsdosJson(relExe)); Files.write(jsdos.resolve("jsdos.json"), buildJsdosJson(relExe));
@@ -216,7 +216,7 @@ public class UploadResource {
// Create .jsdos config (full config, not just autoexec) // Create .jsdos config (full config, not just autoexec)
Path jsdos = tmpBundle.resolve(".jsdos"); Path jsdos = tmpBundle.resolve(".jsdos");
Files.createDirectories(jsdos); Files.createDirectories(jsdos);
String relExe = extractDir.relativize(Path.of(mainExe)).toString().replace('\\', '/'); String relExe = extractDir.relativize(Path.of(mainExe)).toString().replace('/', '\\');
String conf = buildDosboxConf(relExe); String conf = buildDosboxConf(relExe);
Files.writeString(jsdos.resolve("dosbox.conf"), conf); Files.writeString(jsdos.resolve("dosbox.conf"), conf);
Files.write(jsdos.resolve("jsdos.json"), buildJsdosJson(relExe)); Files.write(jsdos.resolve("jsdos.json"), buildJsdosJson(relExe));
@@ -274,7 +274,7 @@ public class UploadResource {
// Split into directory and executable components for subdirectory support // Split into directory and executable components for subdirectory support
String dir = ""; String dir = "";
String exe = relExe; String exe = relExe;
int idx = relExe.lastIndexOf('/'); int idx = Math.max(relExe.lastIndexOf('/'), relExe.lastIndexOf('\\'));
if (idx >= 0) { if (idx >= 0) {
dir = relExe.substring(0, idx); dir = relExe.substring(0, idx);
exe = relExe.substring(idx + 1); exe = relExe.substring(idx + 1);