/**
* Build address string from raw path.
* - Split by '\' into segments.
* - Skip count starts at 1 (so skip=2 means start from the 3rd segment).
* - If there are fewer than 3 segments (no index=2), return "".
* - Join remaining segments with '/'.
*/
private static String buildAddress(String rawPath, int skip) {
if (rawPath == null || rawPath.isBlank()) return "";
// Normalize: trim and remove leading/trailing '\'
String s = rawPath.trim();
if (s.startsWith("\\")) s = s.substring(1);
if (s.endsWith("\\")) s = s.substring(0, s.length() - 1);
if (s.isEmpty()) return "";
// Split by '\'
String[] parts = s.split("\\\\");
// We require at least 3 parts (index 0,1,2). If not, return blank.
if (parts.length < 3) return "";
// Skip logic: skip=1 means start at index=1, skip=2 means start at index=2, etc.
int startIndex = skip;
if (startIndex >= parts.length) return "";
// Build output
StringBuilder out = new StringBuilder();
for (int i = startIndex; i < parts.length; i++) {
String p = parts[i].trim();
if (p.isEmpty()) continue;
if (out.length() > 0) out.append('/');
out.append(p);
}
return out.toString();
}