private static Path convertToAbsolute(Path baseDir, String relativePath) {
    if (relativePath.startsWith("$")) {
      return ResourcePathMacros.resolve(relativePath, baseDir);
    }
    Path root = baseDir;
    while (relativePath.startsWith("../")) {
      relativePath = relativePath.substring(3);
      root = root.getParent();
    }
    if (!relativePath.isEmpty()) {
      root = root.resolve(relativePath);
    }
    return root;
  }
private static Path convertToAbsolute(Path baseDir, String relativePath)