Replace ~ only if the path begins with ~
This commit is contained in:
2
util.go
2
util.go
@@ -62,7 +62,7 @@ func AreSame(lhs string, rhs string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ConvertHome(input string) (string, error) {
|
func ConvertHome(input string) (string, error) {
|
||||||
if strings.Contains(input, "~") {
|
if strings.HasPrefix(input, "~/") {
|
||||||
homedir, err := os.UserHomeDir()
|
homedir, err := os.UserHomeDir()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return input, fmt.Errorf("unable to convert ~ to user directory with error %+v", err)
|
return input, fmt.Errorf("unable to convert ~ to user directory with error %+v", err)
|
||||||
|
Reference in New Issue
Block a user