|
@@ -1,5 +1,5 @@
|
|
|
import { Observable } from 'rxjs'
|
|
|
-import * as fs from 'fs-promise'
|
|
|
+import * as fs from 'mz/fs'
|
|
|
import * as path from 'path'
|
|
|
import { exec } from 'mz/child_process'
|
|
|
const equal = require('deep-equal')
|
|
@@ -59,16 +59,20 @@ export class TerminalSettingsTabComponent {
|
|
|
{ name: 'CMD (stock)', command: 'cmd.exe' },
|
|
|
{ name: 'PowerShell', command: 'powershell.exe' },
|
|
|
]
|
|
|
+
|
|
|
+ // Detect whether BoW is installed
|
|
|
const wslPath = `${process.env.windir}\\system32\\bash.exe`
|
|
|
if (await fs.exists(wslPath)) {
|
|
|
this.shells.push({ name: 'Bash on Windows', command: wslPath })
|
|
|
}
|
|
|
|
|
|
+ // Detect Cygwin
|
|
|
let cygwinPath = await new Promise<string>(resolve => {
|
|
|
let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup' })
|
|
|
reg.get('rootdir', (err, item) => {
|
|
|
if (err) {
|
|
|
resolve(null)
|
|
|
+ return
|
|
|
}
|
|
|
resolve(item.value)
|
|
|
})
|
|
@@ -76,13 +80,29 @@ export class TerminalSettingsTabComponent {
|
|
|
if (cygwinPath) {
|
|
|
this.shells.push({ name: 'Cygwin', command: path.join(cygwinPath, 'bin', 'bash.exe') })
|
|
|
}
|
|
|
+
|
|
|
+ // Detect Git-Bash
|
|
|
+ let gitBashPath = await new Promise<string>(resolve => {
|
|
|
+ let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\GitForWindows' })
|
|
|
+ reg.get('InstallPath', (err, item) => {
|
|
|
+ if (err) {
|
|
|
+ resolve(null)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ resolve(item.value)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ if (gitBashPath) {
|
|
|
+ this.shells.push({ name: 'Git-Bash', command: path.join(gitBashPath, 'bin', 'bash.exe') })
|
|
|
+ }
|
|
|
}
|
|
|
if (this.hostApp.platform === Platform.Linux || this.hostApp.platform === Platform.macOS) {
|
|
|
- this.shells = (await fs.readFile('/etc/shells', 'utf-8'))
|
|
|
+ this.shells = [{ name: 'Default shell', command: '~default-shell~' }]
|
|
|
+ this.shells = this.shells.concat((await fs.readFile('/etc/shells', { encoding: 'utf-8' }))
|
|
|
.split('\n')
|
|
|
.map(x => x.trim())
|
|
|
.filter(x => x && !x.startsWith('#'))
|
|
|
- .map(x => ({ name: x, command: x }))
|
|
|
+ .map(x => ({ name: x, command: x })))
|
|
|
}
|
|
|
this.colorSchemes = (await Promise.all(this.colorSchemeProviders.map(x => x.getSchemes()))).reduce((a, b) => a.concat(b))
|
|
|
}
|