diff --git a/src/main/kotlin/com/jetpackduba/gitnuro/terminal/WindowsTerminalProvider.kt b/src/main/kotlin/com/jetpackduba/gitnuro/terminal/WindowsTerminalProvider.kt index 470b5f0..6487adf 100644 --- a/src/main/kotlin/com/jetpackduba/gitnuro/terminal/WindowsTerminalProvider.kt +++ b/src/main/kotlin/com/jetpackduba/gitnuro/terminal/WindowsTerminalProvider.kt @@ -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 { - 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) + } } } \ No newline at end of file