fix: valid Java char literal for backslash in UploadResource.java
Build & Deploy / build-and-deploy (push) Successful in 45s
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:
@@ -113,7 +113,7 @@ public class UploadResource {
|
|||||||
game.setBundleFile(bundleFile);
|
game.setBundleFile(bundleFile);
|
||||||
game.setPlatform(platform);
|
game.setPlatform(platform);
|
||||||
// Store the selected executable and the full list for the UI picker
|
// 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.setExecutable(relMain);
|
||||||
game.setExecutables(findAllExecutables(extractDir));
|
game.setExecutables(findAllExecutables(extractDir));
|
||||||
if (setupExe != null) {
|
if (setupExe != null) {
|
||||||
@@ -249,7 +249,7 @@ public class UploadResource {
|
|||||||
public FileVisitResult visitFile(Path f, BasicFileAttributes a) {
|
public FileVisitResult visitFile(Path f, BasicFileAttributes a) {
|
||||||
String name = f.getFileName().toString().toLowerCase();
|
String name = f.getFileName().toString().toLowerCase();
|
||||||
if (name.endsWith(".exe") || name.endsWith(".com") || name.endsWith(".bat")) {
|
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;
|
return FileVisitResult.CONTINUE;
|
||||||
}
|
}
|
||||||
@@ -428,7 +428,7 @@ public class UploadResource {
|
|||||||
var allDirs = new java.util.TreeSet<String>();
|
var allDirs = new java.util.TreeSet<String>();
|
||||||
try (var walk = Files.walk(extractDir)) {
|
try (var walk = Files.walk(extractDir)) {
|
||||||
walk.filter(Files::isRegularFile).forEach(f -> {
|
walk.filter(Files::isRegularFile).forEach(f -> {
|
||||||
String entryName = extractDir.relativize(f).toString().replace('\', '/');
|
String entryName = extractDir.relativize(f).toString().replace('\\', '/');
|
||||||
int idx = entryName.lastIndexOf('/');
|
int idx = entryName.lastIndexOf('/');
|
||||||
while (idx >= 0) {
|
while (idx >= 0) {
|
||||||
allDirs.add(entryName.substring(0, idx + 1));
|
allDirs.add(entryName.substring(0, idx + 1));
|
||||||
@@ -449,7 +449,7 @@ public class UploadResource {
|
|||||||
.sorted()
|
.sorted()
|
||||||
.forEach(f -> {
|
.forEach(f -> {
|
||||||
try {
|
try {
|
||||||
String entryName = extractDir.relativize(f).toString().replace('\', '/');
|
String entryName = extractDir.relativize(f).toString().replace('\\', '/');
|
||||||
zos.putNextEntry(new java.util.zip.ZipEntry(entryName));
|
zos.putNextEntry(new java.util.zip.ZipEntry(entryName));
|
||||||
Files.copy(f, zos);
|
Files.copy(f, zos);
|
||||||
zos.closeEntry();
|
zos.closeEntry();
|
||||||
@@ -471,7 +471,7 @@ public class UploadResource {
|
|||||||
.sorted()
|
.sorted()
|
||||||
.forEach(f -> {
|
.forEach(f -> {
|
||||||
try {
|
try {
|
||||||
String entryName = extractDir.relativize(f).toString().replace('\', '/');
|
String entryName = extractDir.relativize(f).toString().replace('\\', '/');
|
||||||
zos.putNextEntry(new java.util.zip.ZipEntry(entryName));
|
zos.putNextEntry(new java.util.zip.ZipEntry(entryName));
|
||||||
Files.copy(f, zos);
|
Files.copy(f, zos);
|
||||||
zos.closeEntry();
|
zos.closeEntry();
|
||||||
@@ -492,11 +492,11 @@ public class UploadResource {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Split a relative executable path into its directory and file parts.
|
* 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}.
|
* If relExe is just a filename, returns {null, relExe}.
|
||||||
*/
|
*/
|
||||||
private static String[] splitDirExe(String relExe) {
|
private static String[] splitDirExe(String relExe) {
|
||||||
int idx = relExe.replace('\', '/').lastIndexOf('/');
|
int idx = relExe.replace('\\', '/').lastIndexOf('/');
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
return new String[]{relExe.substring(0, idx), relExe.substring(idx + 1)};
|
return new String[]{relExe.substring(0, idx), relExe.substring(idx + 1)};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user