MCPcopy Create free account
hub / github.com/xpipe-io/xpipe / getRoot

Method getRoot

core/src/main/java/io/xpipe/core/FilePath.java:64–78  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 }
63
64 public FilePath getRoot() {
65 if (value.startsWith("/")) {
66 return FilePath.of("/");
67 } else if (value.length() >= 2 && value.charAt(1) == ':') {
68 // Without the trailing slash, many programs struggle with this
69 return FilePath.of(value.substring(0, 2) + "\\");
70 } else if (value.startsWith("\\\\")) {
71 var split = split();
72 if (split.size() > 0) {
73 return FilePath.of("\\\\" + split.getFirst());
74 }
75 }
76
77 return FilePath.of("/");
78 }
79
80 public Path toLocalPath() {
81 return Path.of(value);

Callers 3

isRootMethod · 0.95
executeImplMethod · 0.45
syncLocalMethod · 0.45

Calls 4

ofMethod · 0.95
splitMethod · 0.95
startsWithMethod · 0.80
sizeMethod · 0.80

Tested by

no test coverage detected