Rebase upstream

This commit is contained in:
crschnick
2026-09-17 14:41:53 +00:00
parent 3cc6180f32
commit dfbe078ed0
@@ -224,14 +224,24 @@ public final class FilePath {
}
var joined = String.join("/", split());
var prefix = value.startsWith("/") ? "/" : "";
var prefix = hasWindowsUncPrefix() ? "//" : value.startsWith("/") ? "/" : "";
var suffix = value.endsWith("/") || value.endsWith("\\") ? "/" : "";
return FilePath.of(prefix + joined + suffix);
}
public FilePath toWindows() {
var prefix = hasWindowsUncPrefix() ? "\\\\" : "";
var suffix = value.endsWith("/") || value.endsWith("\\") ? "\\" : "";
return FilePath.of(String.join("\\", split()) + suffix);
return FilePath.of(prefix + String.join("\\", split()) + suffix);
}
/**
* Returns whether this file path has a Universal Naming Convention (UNC) prefix.
*
* @return true if the file path has a UNC prefix, false otherwise
*/
private boolean hasWindowsUncPrefix() {
return value.startsWith("\\\\") && !split().isEmpty();
}
public boolean isRoot() {