1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Call the os.UserHomeDir in Home

This commit is contained in:
Tim Scheuermann 2019-10-11 23:18:08 +02:00
parent cdf37f053c
commit d3b6bc503a

View File

@ -6,7 +6,7 @@ package utils
import (
"errors"
"os/user"
"os"
"path/filepath"
)
@ -37,14 +37,5 @@ func ExpandHomeDir(path string) (string, error) {
// Home returns the home directory for the executing user.
// An error is returned if a home directory cannot be detected.
func Home() (string, error) {
currentUser, err := user.Current()
if err != nil {
return "", err
}
if currentUser.HomeDir == "" {
return "", errors.New("cannot find user-specific home dir")
}
return currentUser.HomeDir, nil
return os.UserHomeDir()
}