Пример #1
0
  private static ToolChainCandidate findVisualCpp() {
    // Search in the standard installation locations
    VisualStudioLocator vsLocator =
        new DefaultVisualStudioLocator(
            OperatingSystem.current(),
            NativeServices.getInstance().get(WindowsRegistry.class),
            NativeServices.getInstance().get(SystemInfo.class));
    VisualStudioLocator.SearchResult searchResult = vsLocator.locateVisualStudioInstalls(null);
    if (searchResult.isAvailable()) {
      VisualStudioInstall install = searchResult.getVisualStudio();
      return new InstalledVisualCpp("visual c++").withInstall(install);
    }

    return new UnavailableToolChain("visual c++");
  }
  private static ToolChainCandidate findVisualCpp() {
    // Search first in path, then in the standard installation locations
    File compilerExe = OperatingSystem.current().findInPath("cl.exe");
    if (compilerExe != null) {
      return new InstalledVisualCpp("visual c++");
    }

    VisualStudioLocator vsLocator = new DefaultVisualStudioLocator();
    File visualStudioDir = vsLocator.locateDefaultVisualStudio().getResult();
    if (visualStudioDir != null) {
      VisualStudioInstall install = new VisualStudioInstall(visualStudioDir);
      return new InstalledVisualCpp("visual c++").withInstall(install);
    }

    return new UnavailableToolChain("visual c++");
  }