private String extractRepositoryPathFromConfig()

in nuget-agent/src/jetbrains/buildServer/nuget/agent/runner/install/impl/RepositoryPathResolverImpl.java [106:142]


  private String extractRepositoryPathFromConfig(@NotNull final File configFilePath) throws JDOMException, IOException {
    final Element element = FileUtil.parseDocument(configFilePath);

    final String elementName = element.getName();
    if(elementName.equalsIgnoreCase("configuration")){
      final Element config = element.getChild("config");
      if(config != null){
        for(Object child : config.getChildren("add")){
          final Attribute key = ((Element)child).getAttribute("key");
          if(key != null && key.getValue().equalsIgnoreCase("repositoryPath")){
            String text = PathUtils.normalize(((Element)child).getAttribute("value").getValue().trim());
            LOG.info("Found packages path: " + text);
            return text;
          }
        }
      }

      for (Object child : element.getChildren()){
        if(((Element)child).getName().equalsIgnoreCase("repositoryPath")){
          final String text = PathUtils.normalize(((Element)child).getValue().trim());
          LOG.info("Found repositoryPath: " + text);
          return text;
        }
      }

    } else if(elementName.equalsIgnoreCase("settings")){
      for (Object child : element.getChildren()){
        if(((Element)child).getName().equalsIgnoreCase("repositoryPath")){
          final String text = PathUtils.normalize(((Element)child).getValue().trim());
          LOG.info("Found repositoryPath: " + text);
          return text;
        }
      }
    }

    return null;
  }