How to use the registry-js.RegistryValueType.REG_SZ 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 / editors / win32.ts View on Github external
const publisher = getKeyOrEmpty(keys, 'Publisher')
    const installLocation = getKeyOrEmpty(keys, 'InstallLocation')
    return { displayName, publisher, installLocation }
  }

  if (editor === ExternalEditor.Webstorm) {
    let displayName = ''
    let publisher = ''
    let installLocation = ''

    for (const item of keys) {
      // NOTE:
      // Webstorm adds the current release number to the end of the Display Name, below checks for "WebStorm"
      if (
        item.name === 'DisplayName' &&
        item.type === RegistryValueType.REG_SZ &&
        item.data.startsWith('WebStorm ')
      ) {
        displayName = 'WebStorm'
      } else if (
        item.name === 'Publisher' &&
        item.type === RegistryValueType.REG_SZ
      ) {
        publisher = item.data
      } else if (
        item.name === 'InstallLocation' &&
        item.type === RegistryValueType.REG_SZ
      ) {
        installLocation = item.data
      }
    }
github desktop / desktop / app / src / lib / editors / win32.ts View on Github external
// NOTE:
      // Webstorm adds the current release number to the end of the Display Name, below checks for "WebStorm"
      if (
        item.name === 'DisplayName' &&
        item.type === RegistryValueType.REG_SZ &&
        item.data.startsWith('WebStorm ')
      ) {
        displayName = 'WebStorm'
      } else if (
        item.name === 'Publisher' &&
        item.type === RegistryValueType.REG_SZ
      ) {
        publisher = item.data
      } else if (
        item.name === 'InstallLocation' &&
        item.type === RegistryValueType.REG_SZ
      ) {
        installLocation = item.data
      }
    }

    return { displayName, publisher, installLocation }
  }

  return assertNever(editor, `Unknown external editor: ${editor}`)
}
github bytedance / debugtron / src / main / win.ts View on Github external
(v): v is RegistryStringEntry =>
        v && v.type === RegistryValueType.REG_SZ && v.name === 'DisplayName',
    )
github MHeasell / rwe / launcher / src / launcher / util.ts View on Github external
return taPathRegistryLocations.flatMap(([hkey, key, name]) => {
    const values = enumerateValues(hkey, key);
    const installPathEntry = values.find(x => x.name === name);
    if (
      installPathEntry &&
      installPathEntry.type === RegistryValueType.REG_SZ
    ) {
      return [installPathEntry.data];
    }
    return [];
  });
}
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(
        `[hasGitForWindowsInstall] registry entry found but git-bash.exe does not exist at '${path}'`
      )
    }
  }

  return null
}
github desktop / desktop / app / src / lib / shells / win32.ts View on Github external
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')

    if (await pathExists(path)) {
      return path
    } else if (
      installPathEntry32 &&
      installPathEntry32.type === RegistryValueType.REG_SZ
    ) {
      const path = Path.join(installPathEntry32.data, 'bin\\mintty.exe')
      if (await pathExists(path)) {
        return path
      }
    } else {
      log.debug(`[Cygwin] registry entry found but does not exist at '${path}'`)
    }
  }

  return null
}
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(
        `[PowerShellCore] registry entry found but does not exist at '${path}'`
      )
    }
  }

  return null
}

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