fix: valid Java char literal for backslash in UploadResource.java
Build & Deploy / build-and-deploy (push) Successful in 45s

replace('\', '/') is Java source for a char literal representing
a single backslash character. The previous commit had a single
backslash byte between quotes which made Java interpret it as
\\' (escaped single-quote) causing unclosed char literal errors.
This commit is contained in:
Hermes Agent
2026-05-29 23:01:35 +02:00
parent 9b95e5b994
commit 4c3ded802b
@@ -113,7 +113,7 @@ public class UploadResource {
game.setBundleFile(bundleFile);
game.setPlatform(platform);
// Store the selected executable and the full list for the UI picker
String relMain = extractDir.relativize(Path.of(mainExe)).toString().replace('\', '/');
String relMain = extractDir.relativize(Path.of(mainExe)).toString().replace('\\', '/');
game.setExecutable(relMain);
game.setExecutables(findAllExecutables(extractDir));
if (setupExe != null) {
@@ -249,7 +249,7 @@ public class UploadResource {
public FileVisitResult visitFile(Path f, BasicFileAttributes a) {
String name = f.getFileName().toString().toLowerCase();
if (name.endsWith(".exe") || name.endsWith(".com") || name.endsWith(".bat")) {
result.add(dir.relativize(f).toString().replace('\', '/'));
result.add(dir.relativize(f).toString().replace('\\', '/'));
}
return FileVisitResult.CONTINUE;
}
@@ -428,7 +428,7 @@ public class UploadResource {
var allDirs = new java.util.TreeSet<String>();
try (var walk = Files.walk(extractDir)) {
walk.filter(Files::isRegularFile).forEach(f -> {
String entryName = extractDir.relativize(f).toString().replace('\', '/');
String entryName = extractDir.relativize(f).toString().replace('\\', '/');
int idx = entryName.lastIndexOf('/');
while (idx >= 0) {
allDirs.add(entryName.substring(0, idx + 1));
@@ -449,7 +449,7 @@ public class UploadResource {
.sorted()
.forEach(f -> {
try {
String entryName = extractDir.relativize(f).toString().replace('\', '/');
String entryName = extractDir.relativize(f).toString().replace('\\', '/');
zos.putNextEntry(new java.util.zip.ZipEntry(entryName));
Files.copy(f, zos);
zos.closeEntry();
@@ -471,7 +471,7 @@ public class UploadResource {
.sorted()
.forEach(f -> {
try {
String entryName = extractDir.relativize(f).toString().replace('\', '/');
String entryName = extractDir.relativize(f).toString().replace('\\', '/');
zos.putNextEntry(new java.util.zip.ZipEntry(entryName));
Files.copy(f, zos);
zos.closeEntry();
@@ -492,11 +492,11 @@ public class UploadResource {
/**
* Split a relative executable path into its directory and file parts.
* If relExe contains a '/' (or '\'), returns {dir, file}.
* If relExe contains a '/' (or '\\'), returns {dir, file}.
* If relExe is just a filename, returns {null, relExe}.
*/
private static String[] splitDirExe(String relExe) {
int idx = relExe.replace('\', '/').lastIndexOf('/');
int idx = relExe.replace('\\', '/').lastIndexOf('/');
if (idx >= 0) {
return new String[]{relExe.substring(0, idx), relExe.substring(idx + 1)};
}