// Expand expands the tilde (~) in the front of a path to a the supplied
// directory.
Expand expands the tilde (~) in the front of a path to a the supplied
directory.
// Expand expands the tilde ( ~ ) in the front of a path to a the supplied // directory .
func Expand(u *user.User, file string) string {
	switch {
	case file == "~":
		return u.HomeDir
	case strings.HasPrefix(file, "~/"):
		return filepath.Join(u.HomeDir, strings.TrimPrefix(file, "~/"))
	}
	return file
}
func Expand ( u * user . User , file string ) string { switch { case file == " " : return u . HomeDir case strings . HasPrefix ( file , " " ) : return filepath . Join ( u . HomeDir , strings . TrimPrefix ( file , " " ) ) } return file }
Expand expands the tilde (~) in the front of a path to a the supplied
directory.
Expand expands the tilde ( ~ ) in the front of a path to a the supplied directory .