String (@NotNull String baseRoot, @NotNull String path) { baseRoot = normalize(baseRoot); path = normalize(path); int prefix = findCommonPathPrefixLength(baseRoot, path); if (prefix != 0) { baseRoot = baseRoot.substring(prefix); path = path.substring(prefix); if (!baseRoot.isEmpty()) { return normalize(revertRelativePath(baseRoot.substring(1)) + path); } else if (!path.isEmpty()) { return path.substring(1); } else { return "."; } } if (FileUtil.isAbsolute(path)) { return path; } return normalize(revertRelativePath(baseRoot) + "/" + path); }