Fixed custom terminal emulator not opening on windows
This commit is contained in:
parent
d642c1e2d8
commit
ec6c5412a4
@ -1,24 +1,29 @@
|
||||
package com.jetpackduba.gitnuro.terminal
|
||||
|
||||
import com.jetpackduba.gitnuro.managers.IShellManager
|
||||
import java.io.File
|
||||
import javax.inject.Inject
|
||||
|
||||
class WindowsTerminalProvider @Inject constructor(
|
||||
private val shellManager: IShellManager
|
||||
) : ITerminalProvider {
|
||||
private val powerShellEmulator =
|
||||
TerminalEmulator("Powershell", "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe")
|
||||
|
||||
override fun getTerminalEmulators(): List<TerminalEmulator> {
|
||||
return listOf(
|
||||
// TODO powershell is the only terminal emulator supported until we add support for custom
|
||||
TerminalEmulator("Powershell", "powershell.exe"),
|
||||
)
|
||||
return listOf(powerShellEmulator)
|
||||
}
|
||||
|
||||
override fun isTerminalInstalled(terminalEmulator: TerminalEmulator): Boolean {
|
||||
// TODO how do we know if it's installed? We must check the output when trying to start an app that doesn't exist
|
||||
// We don't care if it's not installed
|
||||
return true
|
||||
}
|
||||
|
||||
override fun startTerminal(terminalEmulator: TerminalEmulator, repositoryPath: String) {
|
||||
shellManager.runCommandInPath(listOf("cmd", "/c", "start", terminalEmulator.path), repositoryPath)
|
||||
if (terminalEmulator == powerShellEmulator) {
|
||||
shellManager.runCommandInPath(listOf("cmd", "/c", "start", terminalEmulator.path), repositoryPath)
|
||||
} else {
|
||||
shellManager.runCommandInPath(listOf("cmd", "/c", terminalEmulator.path), repositoryPath)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user