diff options
Diffstat (limited to 'vendor/github.com/godbus/dbus/v5/homedir.go')
-rw-r--r-- | vendor/github.com/godbus/dbus/v5/homedir.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/github.com/godbus/dbus/v5/homedir.go b/vendor/github.com/godbus/dbus/v5/homedir.go new file mode 100644 index 000000000..0b745f931 --- /dev/null +++ b/vendor/github.com/godbus/dbus/v5/homedir.go @@ -0,0 +1,28 @@ +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 +} |