mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-21 11:59:53 +00:00
40 lines
965 B
TypeScript
40 lines
965 B
TypeScript
import * as path from 'path'
|
|
import { Injectable } from '@angular/core'
|
|
import { HostAppService, Platform } from 'terminus-core'
|
|
|
|
import { ShellProvider, IShell } from '../api'
|
|
|
|
try {
|
|
var wnr = require('windows-native-registry') // tslint:disable-line
|
|
} catch { } // tslint:disable-line
|
|
|
|
@Injectable()
|
|
export class Cygwin64ShellProvider extends ShellProvider {
|
|
constructor (
|
|
private hostApp: HostAppService,
|
|
) {
|
|
super()
|
|
}
|
|
|
|
async provide (): Promise<IShell[]> {
|
|
if (this.hostApp.platform !== Platform.Windows) {
|
|
return []
|
|
}
|
|
|
|
let cygwinPath = wnr.getRegistryValue(wnr.HK.LM, 'Software\\Cygwin\\setup', 'rootdir')
|
|
|
|
if (!cygwinPath) {
|
|
return []
|
|
}
|
|
|
|
return [{
|
|
id: 'cygwin64',
|
|
name: 'Cygwin',
|
|
command: path.join(cygwinPath, 'bin', 'bash.exe'),
|
|
env: {
|
|
TERM: 'cygwin',
|
|
}
|
|
}]
|
|
}
|
|
}
|