String (@NotNull String basePath, @NotNull String relativePath) { final boolean endsWithSlash = StringUtil.endsWithChar(basePath, '/') || StringUtil.endsWithChar(basePath, '\\'); final boolean startsWithSlash = StringUtil.startsWithChar(relativePath, '/') || StringUtil.startsWithChar(relativePath, '\\'); String tail; if (endsWithSlash && startsWithSlash) { tail = trimForwardSlashes(relativePath); } else if (!endsWithSlash && !startsWithSlash && basePath.length() > 0 && relativePath.length() > 0) { tail = "/" + relativePath; } else { tail = relativePath; } return basePath + tail; }