mirror of
https://github.com/Eugeny/tabby.git
synced 2025-10-04 14:04:56 +00:00
use native registry implementation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { getRegistryValue } from 'windows-native-registry'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
import { ShellProvider, IShell } from '../api'
|
||||
@@ -18,7 +18,7 @@ export class Cygwin32ShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let cygwinPath = await Registry.get('HKLM\\Software\\WOW6432Node\\Cygwin\\setup', 'rootdir')
|
||||
let cygwinPath = getRegistryValue('HKLM', 'Software\\WOW6432Node\\Cygwin\\setup', 'rootdir')
|
||||
|
||||
if (!cygwinPath) {
|
||||
return []
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { getRegistryValue } from 'windows-native-registry'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
import { ShellProvider, IShell } from '../api'
|
||||
@@ -18,7 +18,7 @@ export class Cygwin64ShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let cygwinPath = await Registry.get('HKLM\\Software\\Cygwin\\setup', 'rootdir')
|
||||
let cygwinPath = getRegistryValue('HKLM', 'Software\\Cygwin\\setup', 'rootdir')
|
||||
|
||||
if (!cygwinPath) {
|
||||
return []
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import * as path from 'path'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { getRegistryValue } from 'windows-native-registry'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
import { ShellProvider, IShell } from '../api'
|
||||
@@ -18,10 +18,10 @@ export class GitBashShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let gitBashPath = await Registry.get('HKLM\\Software\\GitForWindows', 'InstallPath')
|
||||
let gitBashPath = getRegistryValue('HKLM', 'Software\\GitForWindows', 'InstallPath')
|
||||
|
||||
if (!gitBashPath) {
|
||||
gitBashPath = await Registry.get('HKCU\\Software\\GitForWindows', 'InstallPath')
|
||||
gitBashPath = getRegistryValue('HKCU', 'Software\\GitForWindows', 'InstallPath')
|
||||
}
|
||||
|
||||
if (!gitBashPath) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Registry } from 'rage-edit'
|
||||
import { getRegistryValue } from 'windows-native-registry'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
import { ShellProvider, IShell } from '../api'
|
||||
|
||||
@@ -16,7 +16,7 @@ export class PowerShellCoreShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
|
||||
let pwshPath = await Registry.get('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pwsh.exe', '')
|
||||
const pwshPath = getRegistryValue('HKLM', 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pwsh.exe', '')
|
||||
|
||||
if (!pwshPath) {
|
||||
return []
|
||||
|
@@ -1,7 +1,8 @@
|
||||
import * as fs from 'mz/fs'
|
||||
import slug from 'slug'
|
||||
|
||||
import { Registry } from 'rage-edit'
|
||||
import { getRegistryKey, listRegistrySubkeys } from 'windows-native-registry'
|
||||
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HostAppService, Platform } from 'terminus-core'
|
||||
|
||||
@@ -34,8 +35,9 @@ export class WSLShellProvider extends ShellProvider {
|
||||
}
|
||||
}]
|
||||
|
||||
let lxss = await Registry.get('HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Lxss', true)
|
||||
if (!lxss || !lxss.$values.defaultdistribution || !isWindowsBuild(WIN_BUILD_WSL_EXE_DISTRO_FLAG)) {
|
||||
const lxssPath = 'Software\\Microsoft\\Windows\\CurrentVersion\\Lxss'
|
||||
let lxss = getRegistryKey('HKCU', lxssPath)
|
||||
if (!lxss || !lxss.DefaultDistribution || !isWindowsBuild(WIN_BUILD_WSL_EXE_DISTRO_FLAG)) {
|
||||
if (await fs.exists(bashPath)) {
|
||||
return [{
|
||||
id: 'wsl',
|
||||
@@ -50,17 +52,18 @@ export class WSLShellProvider extends ShellProvider {
|
||||
return []
|
||||
}
|
||||
}
|
||||
for (let child of Object.values(lxss)) {
|
||||
if (!(child as any).$values) {
|
||||
for (let child of listRegistrySubkeys('HKCU', lxssPath)) {
|
||||
let childKey = getRegistryKey('HKCU', lxssPath + '\\' + child)
|
||||
if (!childKey.DistributionName) {
|
||||
continue
|
||||
}
|
||||
let name = (child as any).$values.distributionname
|
||||
let name = childKey.DistributionName.value
|
||||
shells.push({
|
||||
id: `wsl-${slug(name)}`,
|
||||
name: `WSL / ${name}`,
|
||||
command: wslPath,
|
||||
args: ['-d', name],
|
||||
fsBase: (child as any).$values.basepath + '\\rootfs',
|
||||
fsBase: childKey.BasePath.value + '\\rootfs',
|
||||
env: {
|
||||
TERM: 'xterm-color',
|
||||
COLORTERM: 'truecolor',
|
||||
|
Reference in New Issue
Block a user