github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/adhoc/util/util_linux.go (about)

     1  package util
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  )
     7  
     8  func dataBaseDirectory() string {
     9  	if dir, ok := os.LookupEnv("XDG_DATA_HOME"); ok {
    10  		return dir
    11  	}
    12  	homeDir, ok := os.LookupEnv("HOME")
    13  	if !ok {
    14  		homeDir = "/"
    15  	}
    16  	return filepath.Join(homeDir, ".local", "share")
    17  }