fix method of getting user's home path

This commit is contained in:
vitalii 2019-12-15 01:28:41 +02:00
parent 9f625b1b8e
commit c4c707907d

View File

@ -9,6 +9,7 @@ import (
"os"
"os/user"
"path/filepath"
"runtime"
"strings"
)
@ -66,10 +67,21 @@ func fail(err interface{}) {
}
func getHome() string {
if u, e := user.Current(); e != nil {
u, e := user.Current()
if e != nil {
return os.Getenv("HOME")
}
if u != nil {
return u.HomeDir
}
return os.Getenv("HOME")
switch runtime.GOOS {
case "windows":
return ""
default:
return "~/"
}
}
func getCmd(method string) func(c *d.Client, p0, p1 string) error {