config: support ~ as user's home directory for Include#58
Open
lonnywong wants to merge 1 commit intokevinburke:masterfrom
Open
config: support ~ as user's home directory for Include#58lonnywong wants to merge 1 commit intokevinburke:masterfrom
~ as user's home directory for Include#58lonnywong wants to merge 1 commit intokevinburke:masterfrom
Conversation
e.g., `Include ~/other/config` on Linux, `Include ~\other\config` on Windows.
kevinburke
reviewed
Oct 22, 2023
| } 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:]) |
Owner
There was a problem hiding this comment.
Is 2: right here? Wouldn't it be different in the first condition (only 2 chars) vs. the second condition (3 chars) ?
Author
There was a problem hiding this comment.
The second one is 2 chars. The first \ of \\ is the escape char for \. "~\\" in source code means ~\.
|
any update on this? Ii would be very nice for this tool to support path with trailing home symbol. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
e.g.,
Include ~/other/configon Linux,Include ~\other\configon Windows.