Пример #1
0
  private void locateKitsInRegistry(String baseKey) {
    String[] versions = {VERSION_KIT_8, VERSION_KIT_81};
    String[] keys = {REGISTRY_KIT_8, REGISTRY_KIT_81};

    for (int i = 0; i != keys.length; ++i) {
      try {
        File kitDir =
            GFileUtils.canonicalise(
                new File(
                    windowsRegistry.getStringValue(
                        WindowsRegistry.Key.HKEY_LOCAL_MACHINE,
                        baseKey + REGISTRY_ROOTPATH_KIT,
                        keys[i])));
        if (isWindowsSdk(kitDir)) {
          LOGGER.debug("Found Windows Kit {} at {}", versions[i], kitDir);
          addSdk(kitDir, versions[i], NAME_KIT + " " + versions[i]);
        } else {
          LOGGER.debug(
              "Ignoring candidate Windows Kit directory {} as it does not look like a Windows Kit installation.",
              kitDir);
        }
      } catch (MissingRegistryEntryException e) {
        // Ignore the version if the string cannot be read
      }
    }
  }
Пример #2
0
  private void locateSdksInRegistry(String baseKey) {
    try {
      List<String> subkeys =
          windowsRegistry.getSubkeys(
              WindowsRegistry.Key.HKEY_LOCAL_MACHINE, baseKey + REGISTRY_ROOTPATH_SDK);
      for (String subkey : subkeys) {
        try {
          String basePath = baseKey + REGISTRY_ROOTPATH_SDK + "\\" + subkey;
          File sdkDir =
              GFileUtils.canonicalise(
                  new File(
                      windowsRegistry.getStringValue(
                          WindowsRegistry.Key.HKEY_LOCAL_MACHINE, basePath, REGISTRY_FOLDER)));
          String version =
              formatVersion(
                  windowsRegistry.getStringValue(
                      WindowsRegistry.Key.HKEY_LOCAL_MACHINE, basePath, REGISTRY_VERSION));
          String name =
              windowsRegistry.getStringValue(
                  WindowsRegistry.Key.HKEY_LOCAL_MACHINE, basePath, REGISTRY_NAME);

          if (isWindowsSdk(sdkDir)) {
            LOGGER.debug("Found Windows SDK {} at {}", version, sdkDir);
            addSdk(sdkDir, version, name);
          } else {
            LOGGER.debug(
                "Ignoring candidate Windows SDK directory {} as it does not look like a Windows SDK installation.",
                sdkDir);
          }
        } catch (MissingRegistryEntryException e) {
          // Ignore the subkey if it doesn't have a folder and version
        }
      }
    } catch (MissingRegistryEntryException e) {
      // No SDK information available in the registry
    }
  }