func HomeDir() string {
	if runtime.GOOS == "windows" {

		// First prefer the HOME environmental variable
		if home := os.Getenv("HOME"); len(home) > 0 {
			if _, err := os.Stat(home); err == nil {
				return home
			}
		}
		if homeDrive, homePath := os.Getenv("HOMEDRIVE"), os.Getenv("HOMEPATH"); len(homeDrive) > 0 && len(homePath) > 0 {
			homeDir := homeDrive + homePath
			if _, err := os.Stat(homeDir); err == nil {
				return homeDir
			}
		}
		if userProfile := os.Getenv("USERPROFILE"); len(userProfile) > 0 {
			if _, err := os.Stat(userProfile); err == nil {
				return userProfile
			}
		}
	}
	return os.Getenv("HOME")
}
// HomeDir returns the home directory for the current user
HomeDir returns the home directory for the current user
// HomeDir returns the home directory for the current user
func HomeDir() string {
	if runtime.GOOS == "windows" {
		if home := os.Getenv("HOME"); len(home) > 0 {
			if _, err := os.Stat(home); err == nil {
				return home
			}
		}
		if homeDrive, homePath := os.Getenv("HOMEDRIVE"), os.Getenv("HOMEPATH"); len(homeDrive) > 0 && len(homePath) > 0 {
			homeDir := homeDrive + homePath
			if _, err := os.Stat(homeDir); err == nil {
				return homeDir
			}
		}
		if userProfile := os.Getenv("USERPROFILE"); len(userProfile) > 0 {
			if _, err := os.Stat(userProfile); err == nil {
				return userProfile
			}
		}
	}
	return os.Getenv("HOME")
}
func HomeDir ( ) string { if runtime . GOOS == " " { if home := os . Getenv ( " " ) ; len ( home ) > 0 { if _ , err := os . Stat ( home ) ; err == nil { return home } } if homeDrive , homePath := os . Getenv ( " " ) , os . Getenv ( " " ) ; len ( homeDrive ) > 0 && len ( homePath ) > 0 { homeDir := homeDrive + homePath if _ , err := os . Stat ( homeDir ) ; err == nil { return homeDir } } if userProfile := os . Getenv ( " " ) ; len ( userProfile ) > 0 { if _ , err := os . Stat ( userProfile ) ; err == nil { return userProfile } } } return os . Getenv ( " " ) }
HomeDir returns the home directory for the current user
HomeDir returns the home directory for the current user
// First prefer the HOME environmental variable