in src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/ResourceRuntimeExtension.java [187:215]
private String buildPath(String path, Map<String, Object> options, Resource currentResource) {
String prependPath = getOption(OPTION_PREPEND_PATH, options, StringUtils.EMPTY);
if (prependPath == null) {
prependPath = StringUtils.EMPTY;
}
if (StringUtils.isNotEmpty(prependPath)) {
if (!prependPath.startsWith("/")) {
prependPath = "/" + prependPath;
}
if (!prependPath.endsWith("/")) {
prependPath += "/";
}
}
path = getOption(OPTION_PATH, options, StringUtils.isNotEmpty(path) ? path : StringUtils.EMPTY);
String appendPath = getOption(OPTION_APPEND_PATH, options, StringUtils.EMPTY);
if (appendPath == null) {
appendPath = StringUtils.EMPTY;
}
if (StringUtils.isNotEmpty(appendPath)) {
if (!appendPath.startsWith("/")) {
appendPath = "/" + appendPath;
}
}
String finalPath = prependPath + path + appendPath;
if (!finalPath.startsWith("/")) {
finalPath = currentResource.getPath() + "/" + finalPath;
}
return ResourceUtil.normalize(finalPath);
}