package conf import ( "fmt" "os/user" "path/filepath" ) func GetHomeDir() (string, error) { usr, err := user.Current() if err != nil { return "", fmt.Errorf("GetHomeDir: unable to retrieve current user") } return usr.HomeDir, nil } func DataDir(homeDir string) string { return filepath.Join(homeDir, ".hui") } func HugoDir(homeDir string) string { return filepath.Join(DataDir(homeDir), "hugo") } func HugoBinPath(homeDir string) string { return filepath.Join(HugoDir(homeDir), "hugo") } func SitesDir(homeDir string) string { return filepath.Join(DataDir(homeDir), "sites") } func NewSiteDir(homeDir, newSiteName string) string { return filepath.Join(DataDir(homeDir), "sites", newSiteName) }