- теперь терминал открывается сразу в папке проекта
This commit is contained in:
parent
d54e9dd058
commit
1d4c3fa904
@ -48,7 +48,7 @@ public class OpenRemoteTerminalAction extends AnAction {
|
||||
SftpSessionManager.getInstance(project)
|
||||
.getShellChannel(server);
|
||||
|
||||
TtyConnector connector = new SshTtyConnector(shellChannel);
|
||||
TtyConnector connector = new SshTtyConnector(shellChannel, server.remoteProjectPath);
|
||||
|
||||
ToolWindow terminalToolWindow =
|
||||
ToolWindowManager.getInstance(project).getToolWindow("Terminal");
|
||||
|
||||
@ -15,12 +15,22 @@ public class SshTtyConnector implements TtyConnector {
|
||||
private final OutputStream outputStream;
|
||||
private final Reader reader;
|
||||
|
||||
public SshTtyConnector(ChannelShell channel) {
|
||||
public SshTtyConnector(ChannelShell channel, String initialPath) {
|
||||
this.channel = channel;
|
||||
|
||||
try {
|
||||
this.inputStream = channel.getInputStream();
|
||||
this.outputStream = channel.getOutputStream();
|
||||
this.reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
|
||||
|
||||
if (initialPath != null && !initialPath.isBlank()) {
|
||||
outputStream.write(
|
||||
("cd \"" + initialPath + "\"\n")
|
||||
.getBytes(StandardCharsets.UTF_8)
|
||||
);
|
||||
outputStream.flush();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user