fix: backslash path splitting bug in ConfigPatcher
Build & Deploy / build-and-deploy (push) Successful in 40s

Root cause: the separator check used '\\\\'.equals(sep) comparing a
2-char Java string literal to a 1-char substring result — always false.
This caused backslash paths (C:\FALLOUT1\MASTER.DAT) to never be split
into components, so stale prefixes were never detected or rewritten.

Fix: use char comparison (sep == '\\') which correctly identifies the
separator type. Affected both findReplacement and existsIgnoreCase.

This was a pre-existing bug from the original UploadResource code that
was carried over during the refactor. Re-uploading Fallout after this
fix will correctly patch FALLOUT.CFG paths.
This commit is contained in:
David Alvarez
2026-06-09 13:35:35 +02:00
parent a109dee5ba
commit 397c99bd0c
@@ -86,10 +86,10 @@ public class ConfigPatcher {
private static String findReplacement(String fullPath, Path extractDir, Set<String> seenPrefixes) { private static String findReplacement(String fullPath, Path extractDir, Set<String> seenPrefixes) {
String drivePrefix = fullPath.substring(0, 2); String drivePrefix = fullPath.substring(0, 2);
String sep = fullPath.substring(2, 3); char sep = fullPath.charAt(2);
String splitRegex = sep == '\\' ? "\\\\" : "/";
String relPath = fullPath.substring(3); String relPath = fullPath.substring(3);
String splitter = "\\\\".equals(sep) ? "\\\\\\\\" : "/"; String[] parts = relPath.split(splitRegex, -1);
String[] parts = relPath.split(splitter, -1);
for (int skip = 0; skip < parts.length; skip++) { for (int skip = 0; skip < parts.length; skip++) {
StringBuilder suffix = new StringBuilder(); StringBuilder suffix = new StringBuilder();
@@ -122,8 +122,8 @@ public class ConfigPatcher {
} }
private static boolean existsIgnoreCase(Path base, String relativePath) { private static boolean existsIgnoreCase(Path base, String relativePath) {
String sep = relativePath.contains("\\") ? "\\\\\\\\" : "/"; char sep = relativePath.contains("\\") ? '\\' : '/';
String[] parts = relativePath.split(sep, -1); String[] parts = relativePath.split(sep == '\\' ? "\\\\" : "/", -1);
Path current = base; Path current = base;
try { try {
for (int i = 0; i < parts.length; i++) { for (int i = 0; i < parts.length; i++) {