Skip to content

config: support ~ as user's home directory for Include#58

Open
lonnywong wants to merge 1 commit intokevinburke:masterfrom
trzsz:master
Open

config: support ~ as user's home directory for Include#58
lonnywong wants to merge 1 commit intokevinburke:masterfrom
trzsz:master

Conversation

@lonnywong
Copy link

e.g., Include ~/other/config on Linux, Include ~\other\config on Windows.

e.g., `Include ~/other/config` on Linux, `Include ~\other\config` on Windows.
} 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:])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 2: right here? Wouldn't it be different in the first condition (only 2 chars) vs. the second condition (3 chars) ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second one is 2 chars. The first \ of \\ is the escape char for \. "~\\" in source code means ~\.

@giuseongit
Copy link

any update on this? Ii would be very nice for this tool to support path with trailing home symbol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants