private static String getToolPath()

in cloud-vmware-agent/src/main/java/jetbrains/buildServer/clouds/vmware/VMWarePropertiesReader.java [173:200]


  private static String getToolPath(@NotNull final BuildAgentConfiguration configuration) {
    final String rpctoolPath = TeamCityProperties.getProperty(RPC_TOOL_PARAMETER);
    if (StringUtil.isNotEmpty(rpctoolPath)) {
      return rpctoolPath;
    }

    if (SystemInfo.isUnix) { // Linux, MacOSX, FreeBSD
      final Map<String, String> envs = configuration.getBuildParameters().getEnvironmentVariables();
      final String path = envs.get("PATH");
      if (path != null) {
        for (String p : StringUtil.splitHonorQuotes(path, File.pathSeparatorChar)) {
          final File file = new File(p, VMWARE_RPCTOOL_NAME);
          if (file.exists()) {
            return file.getAbsolutePath();
          }
        }
      }
    }
    if (SystemInfo.isLinux) {
      return getExistingCommandPath(LINUX_COMMANDS);
    } else if (SystemInfo.isWindows) {
      return getExistingCommandPath(WINDOWS_COMMANDS);
    } else if (SystemInfo.isMac) {
      return getExistingCommandPath(MAC_COMMANDS);
    } else {
      return getExistingCommandPath(LINUX_COMMANDS); //todo: update for other OS'es
    }
  }