Skip to content

Commit

Permalink
Fixes #45
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanp413 committed Dec 16, 2022
1 parent d5f471a commit c5a0340
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ssh/sshConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import * as fs from 'fs';
import * as path from 'path';
import SSHConfig, { Directive, Line, Section } from 'ssh-config';
import * as vscode from 'vscode';
import { exists as fileExists } from '../common/files';
import { exists as fileExists, untildify } from '../common/files';
import { isWindows } from '../common/platform';

const systemSSHConfig = isWindows ? path.resolve(process.env.ALLUSERSPROFILE || 'C:\\ProgramData', 'ssh\\ssh_config') : '/etc/ssh/ssh_config';
const defaultSSHConfigPath = path.resolve(os.homedir(), '.ssh/config');

export function getSSHConfigPath() {
const remoteSSHconfig = vscode.workspace.getConfiguration('remote.SSH');
return remoteSSHconfig.get<string>('configFile') || defaultSSHConfigPath;
const sshConfigPath = vscode.workspace.getConfiguration('remote.SSH').get<string>('configFile');
return sshConfigPath ? untildify(sshConfigPath) : defaultSSHConfigPath;
}

function isDirective(line: Line): line is Directive {
return line.type === SSHConfig.DIRECTIVE
return line.type === SSHConfig.DIRECTIVE;
}

function isHostSection(line: Line): line is Section {
Expand Down

0 comments on commit c5a0340

Please sign in to comment.