How to use the registry-js.enumerateValues function in registry-js

To help you get started, we’ve selected a few registry-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github desktop / desktop / app / src / lib / shells / win32.ts View on Github external
async function findHyper(): Promise {
  const hyper = enumerateValues(
    HKEY.HKEY_CURRENT_USER,
    'Software\\Classes\\Directory\\Background\\shell\\Hyper\\command'
  )

  if (hyper.length === 0) {
    return null
  }

  const first = hyper[0]
  if (first.type === RegistryValueType.REG_SZ) {
    // Registry key is structured as "{installationPath}\app-x.x.x\Hyper.exe" "%V"

    // This regex is designed to get the path to the version-specific Hyper.
    // commandPieces = ['"{installationPath}\app-x.x.x\Hyper.exe"', '"', '{installationPath}\app-x.x.x\Hyper.exe', ...]
    const commandPieces = first.data.match(/(["'])(.*?)\1/)
    const localAppData = process.env.LocalAppData
github desktop / desktop / app / src / lib / shells / win32.ts View on Github external
async function findCygwin(): Promise {
  const registryPath64 = enumerateValues(
    HKEY.HKEY_LOCAL_MACHINE,
    'SOFTWARE\\Cygwin\\setup'
  )
  const registryPath32 = enumerateValues(
    HKEY.HKEY_LOCAL_MACHINE,
    'SOFTWARE\\WOW6432Node\\Cygwin\\setup'
  )

  if (registryPath64 == null || registryPath32 == null) {
    return null
  }

  const installPathEntry64 = registryPath64.find(e => e.name === 'rootdir')
  const installPathEntry32 = registryPath32.find(e => e.name === 'rootdir')
  if (
    installPathEntry64 &&
    installPathEntry64.type === RegistryValueType.REG_SZ
  ) {
    const path = Path.join(installPathEntry64.data, 'bin\\mintty.exe')
github desktop / desktop / app / src / lib / editors / win32.ts View on Github external
async function findApplication(editor: ExternalEditor): Promise {
  const registryKeys = getRegistryKeys(editor)

  let keys: ReadonlyArray = []
  for (const { key, subKey } of registryKeys) {
    keys = enumerateValues(key, subKey)
    if (keys.length > 0) {
      break
    }
  }

  if (keys.length === 0) {
    return null
  }

  const {
    displayName,
    publisher,
    installLocation,
  } = extractApplicationInformation(editor, keys)

  if (!isExpectedInstallation(editor, displayName, publisher)) {
github bytedance / debugtron / src / main / win.ts View on Github external
return enumerateKeys(key, subkey).map(k =>
      enumerateValues(key, subkey + '\\' + k),
    )
github desktop / desktop / app / src / lib / shells / win32.ts View on Github external
async function findGitBash(): Promise {
  const registryPath = enumerateValues(
    HKEY.HKEY_LOCAL_MACHINE,
    'SOFTWARE\\GitForWindows'
  )

  if (registryPath.length === 0) {
    return null
  }

  const installPathEntry = registryPath.find(e => e.name === 'InstallPath')
  if (installPathEntry && installPathEntry.type === RegistryValueType.REG_SZ) {
    const path = Path.join(installPathEntry.data, 'git-bash.exe')

    if (await pathExists(path)) {
      return path
    } else {
      log.debug(
github desktop / desktop / app / src / lib / ssh / ssh-environment.ts View on Github external
async function findGitForWindowsInstall(): Promise {
  const registryPath = enumerateValues(
    HKEY.HKEY_LOCAL_MACHINE,
    'SOFTWARE\\GitForWindows'
  )

  if (registryPath.length === 0) {
    return null
  }

  const installPathEntry = registryPath.find(e => e.name === 'InstallPath')
  if (installPathEntry && installPathEntry.type === RegistryValueType.REG_SZ) {
    const path = Path.join(installPathEntry.data, 'git-bash.exe')

    if (await pathExists(path)) {
      return installPathEntry.data
    } else {
      log.debug(
github desktop / desktop / app / src / lib / shells / win32.ts View on Github external
async function findPowerShellCore(): Promise {
  const powerShellCore = enumerateValues(
    HKEY.HKEY_LOCAL_MACHINE,
    'Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pwsh.exe'
  )

  if (powerShellCore.length === 0) {
    return null
  }

  const first = powerShellCore[0]
  if (first.type === RegistryValueType.REG_SZ) {
    const path = first.data

    if (await pathExists(path)) {
      return path
    } else {
      log.debug(

registry-js

A simple and opinionated library for working with the Windows registry

MIT
Latest version published 2 months ago

Package Health Score

73 / 100
Full package analysis

Similar packages