Fixed wrong path when opening terminal in macos
This commit is contained in:
parent
7df6381813
commit
abec077f23
@ -4,7 +4,6 @@ package com.jetpackduba.gitnuro.terminal
|
|||||||
import com.jetpackduba.gitnuro.managers.IShellManager
|
import com.jetpackduba.gitnuro.managers.IShellManager
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
// TODO Test this on MacOS
|
|
||||||
class MacTerminalProvider @Inject constructor(
|
class MacTerminalProvider @Inject constructor(
|
||||||
private val shellManager: IShellManager
|
private val shellManager: IShellManager
|
||||||
) : ITerminalProvider {
|
) : ITerminalProvider {
|
||||||
@ -15,12 +14,11 @@ class MacTerminalProvider @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun isTerminalInstalled(terminalEmulator: TerminalEmulator): Boolean {
|
override fun isTerminalInstalled(terminalEmulator: TerminalEmulator): Boolean {
|
||||||
val checkTerminalInstalled = shellManager.runCommand(listOf("which", terminalEmulator.path, "2>/dev/null"))
|
return true // TODO Return true always until we support multiple terminals
|
||||||
|
|
||||||
return !checkTerminalInstalled.isNullOrEmpty()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun startTerminal(terminalEmulator: TerminalEmulator, repositoryPath: String) {
|
override fun startTerminal(terminalEmulator: TerminalEmulator, repositoryPath: String) {
|
||||||
shellManager.runCommandInPath(listOf("open", "-a", terminalEmulator.path), repositoryPath)
|
// TODO Check if passing the path as argument is required for other terminal emulators
|
||||||
|
shellManager.runCommandInPath(listOf("open", "-a", terminalEmulator.path, "--args", repositoryPath), repositoryPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,6 +8,7 @@ class WindowsTerminalProvider @Inject constructor(
|
|||||||
) : ITerminalProvider {
|
) : ITerminalProvider {
|
||||||
override fun getTerminalEmulators(): List<TerminalEmulator> {
|
override fun getTerminalEmulators(): List<TerminalEmulator> {
|
||||||
return listOf(
|
return listOf(
|
||||||
|
// TODO powershell is the only terminal emulator supported until we add support for custom
|
||||||
TerminalEmulator("Powershell", "powershell.exe"),
|
TerminalEmulator("Powershell", "powershell.exe"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user