gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

homedir.go (325B)


      1 package dbus
      2 
      3 import (
      4 	"os"
      5 	"sync"
      6 )
      7 
      8 var (
      9 	homeDir     string
     10 	homeDirLock sync.Mutex
     11 )
     12 
     13 func getHomeDir() string {
     14 	homeDirLock.Lock()
     15 	defer homeDirLock.Unlock()
     16 
     17 	if homeDir != "" {
     18 		return homeDir
     19 	}
     20 
     21 	homeDir = os.Getenv("HOME")
     22 	if homeDir != "" {
     23 		return homeDir
     24 	}
     25 
     26 	homeDir = lookupHomeDir()
     27 	return homeDir
     28 }