Skip to content

Commit

Permalink
config: support ~ as user's home directory for Include
Browse files Browse the repository at this point in the history
e.g., `Include ~/other/config` on Linux, `Include ~\other\config` on Windows.
  • Loading branch information
lonnywong authored and kevinburke committed Oct 22, 2023
1 parent 1d09c0b commit 9cd03f8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ func NewInclude(directives []string, hasEquals bool, pos Position, comment strin
path = directives[i]
} else if system {
path = filepath.Join("/etc/ssh", directives[i])
} else if strings.HasPrefix(directives[i], "~/") || strings.HasPrefix(directives[i], "~\\") {
path = filepath.Join(homedir(), directives[i][2:])
} else {
path = filepath.Join(homedir(), ".ssh", directives[i])
}
Expand Down

0 comments on commit 9cd03f8

Please sign in to comment.