cri-o/vendor/github.com/godbus/dbus/homedir.go
Mrunal Patel 69ed8639cd Update dependencies to include github.com/godbus/dbus
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-03-01 16:49:45 -08:00

28 lines
325 B
Go

package dbus
import (
"os"
"sync"
)
var (
homeDir string
homeDirLock sync.Mutex
)
func getHomeDir() string {
homeDirLock.Lock()
defer homeDirLock.Unlock()
if homeDir != "" {
return homeDir
}
homeDir = os.Getenv("HOME")
if homeDir != "" {
return homeDir
}
homeDir = lookupHomeDir()
return homeDir
}