dropped winreg in favor of rage-edit

This commit is contained in:
Eugene Pankov
2018-10-08 13:40:16 -07:00
parent 73eb8bdbe7
commit 2ec3833977
12 changed files with 26 additions and 108 deletions

View File

@@ -1,14 +1,10 @@
import * as path from 'path'
import { Injectable } from '@angular/core'
import { Registry } from 'rage-edit'
import { HostAppService, Platform } from 'terminus-core'
import { ShellProvider, IShell } from '../api'
let Registry = null
try {
Registry = require('winreg')
} catch (_) { } // tslint:disable-line no-empty
@Injectable()
export class Cygwin32ShellProvider extends ShellProvider {
constructor (
@@ -22,15 +18,7 @@ export class Cygwin32ShellProvider extends ShellProvider {
return []
}
let cygwinPath = await new Promise<string>(resolve => {
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup', arch: 'x86' })
reg.get('rootdir', (err, item) => {
if (err || !item) {
return resolve(null)
}
resolve(item.value)
})
})
let cygwinPath = await Registry.get('HKLM\\Software\\WOW6432Node\\Cygwin\\setup', 'rootdir')
if (!cygwinPath) {
return []

View File

@@ -1,14 +1,10 @@
import * as path from 'path'
import { Injectable } from '@angular/core'
import { Registry } from 'rage-edit'
import { HostAppService, Platform } from 'terminus-core'
import { ShellProvider, IShell } from '../api'
let Registry = null
try {
Registry = require('winreg')
} catch (_) { } // tslint:disable-line no-empty
@Injectable()
export class Cygwin64ShellProvider extends ShellProvider {
constructor (
@@ -22,15 +18,7 @@ export class Cygwin64ShellProvider extends ShellProvider {
return []
}
let cygwinPath = await new Promise<string>(resolve => {
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup', arch: 'x64' })
reg.get('rootdir', (err, item) => {
if (err || !item) {
return resolve(null)
}
resolve(item.value)
})
})
let cygwinPath = await Registry.get('HKLM\\Software\\Cygwin\\setup', 'rootdir')
if (!cygwinPath) {
return []

View File

@@ -1,14 +1,10 @@
import * as path from 'path'
import { Injectable } from '@angular/core'
import { Registry } from 'rage-edit'
import { HostAppService, Platform } from 'terminus-core'
import { ShellProvider, IShell } from '../api'
let Registry = null
try {
Registry = require('winreg')
} catch (_) { } // tslint:disable-line no-empty
@Injectable()
export class GitBashShellProvider extends ShellProvider {
constructor (
@@ -22,16 +18,7 @@ export class GitBashShellProvider extends ShellProvider {
return []
}
let gitBashPath = await new Promise<string>(resolve => {
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\GitForWindows' })
reg.get('InstallPath', (err, item) => {
if (err || !item) {
resolve(null)
return
}
resolve(item.value)
})
})
let gitBashPath = await Registry.get('HKLM\\Software\\GitForWindows', 'InstallPath')
if (!gitBashPath) {
gitBashPath = await new Promise<string>(resolve => {

View File

@@ -1,13 +1,8 @@
import { Injectable } from '@angular/core'
import { Registry } from 'rage-edit'
import { HostAppService, Platform } from 'terminus-core'
import { ShellProvider, IShell } from '../api'
let Registry = null
try {
Registry = require('winreg')
} catch (_) { } // tslint:disable-line no-empty
@Injectable()
export class PowerShellCoreShellProvider extends ShellProvider {
constructor (
@@ -21,15 +16,7 @@ export class PowerShellCoreShellProvider extends ShellProvider {
return []
}
let pwshPath = await new Promise<string>(resolve => {
let reg = new Registry({ hive: Registry.HKLM, key: '\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pwsh.exe', arch: 'x64' })
reg.get('', (err, item) => {
if (err || !item) {
return resolve(null)
}
resolve(item.value)
})
})
let pwshPath = await Registry.get('HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\pwsh.exe', '')
if (!pwshPath) {
return []