rclone/vendor/github.com/pengsrc/go-shared/utils/home.go
2018-06-17 17:59:12 +01:00

17 lines
284 B
Go

package utils
import (
"os"
"runtime"
)
// GetHome returns the home directory.
func GetHome() string {
if runtime.GOOS == "windows" {
home := os.Getenv("HOMEDRIVE") + os.Getenv("HOMEPATH")
if home == "" {
home = os.Getenv("USERPROFILE")
}
}
return os.Getenv("HOME")
}