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:
parent
cdf37f053c
commit
d3b6bc503a
@ -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()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user