IFolder mediumFolder = helper.getTmlRoot().getFolder(WGADesignStructureHelper.determineMediaKey(referer));
// cut off path up to medium
int segments = referer.getLocation().matchingFirstSegments(mediumFolder.getLocation());
IPath relativePathToMediumFolder = referer.getLocation().removeFirstSegments(segments).removeLastSegments(1);
String referencePath = null;
reference = reference.toLowerCase();
if (reference.startsWith("::")) {
String tmpPath = "/";
for (int i = 0; i < relativePathToMediumFolder.segmentCount(); i++) {
tmpPath += relativePathToMediumFolder.segment(i) + "/";
}
referencePath = reference.replace("::", tmpPath);
referencePath = referencePath.replaceAll(":", "/");
//referencePath += "." + scriptType;
} else {
VersionCompliance versionCompliance = WGADesignStructureHelper.getWGAVersionCompliance(referer);
if (versionCompliance != null && versionCompliance.toWGAVersion() != null && versionCompliance.toWGAVersion().isAtLeast(5, 4)) {
if (reference.endsWith("@base")) {
IPath path = referer.getFullPath();
if (path.toString().contains("/overlay/")) {
// this is a base reference in an overlay provider - remove @base marker and add overlay root
reference = reference.substring(0, reference.lastIndexOf("@"));
reference = "overlay:" + reference;
}
}