// resolveHomeDir converts a path referencing the home directory via "~"
// to an absolute path
resolveHomeDir converts a path referencing the home directory via "~"
to an absolute path
// resolveHomeDir converts a path referencing the home directory via " ~ " // to an absolute path
func resolveHomeDir(path string) (string, error) {
	if !(path == "~" || strings.HasPrefix(path, "~/")) {
		return path, nil
	}
	home, err := unshare.HomeDir()
	if err != nil {
		return "", err
	}
	return strings.Replace(path, "~", home, 1), nil
}
func resolveHomeDir ( path string ) ( string , error ) { if ! ( path == " " || strings . HasPrefix ( path , " " ) ) { return path , nil } home , err := unshare . HomeDir ( ) if err != nil { return " " , err } return strings . Replace ( path , " " , home , 1 ) , nil }
resolveHomeDir converts a path referencing the home directory via "~"
to an absolute path
resolveHomeDir converts a path referencing the home directory via " ~ " to an absolute path
// check if the path references the home dir to avoid work // don't use strings.HasPrefix(path, "~") as this doesn't match "~" alone // use strings.HasPrefix(...) to not match "something/~/something" // path does not reference home dir -> Nothing to do // only get HomeDir when necessary // replace the first "~" (start of path) with the HomeDir to resolve "~"