github.com/loafoe/cli@v7.1.0+incompatible/util/configv3/home_dir_unix.go (about) 1 // +build !windows 2 3 package configv3 4 5 import ( 6 "os" 7 "path/filepath" 8 ) 9 10 // ConfigFilePath returns the location of the config file 11 func ConfigFilePath() string { 12 return filepath.Join(configDirectory(), "config.json") 13 } 14 15 func configDirectory() string { 16 return filepath.Join(homeDirectory(), ".cf") 17 } 18 19 func homeDirectory() string { 20 var homeDir string 21 switch { 22 case os.Getenv("CF_HOME") != "": 23 homeDir = os.Getenv("CF_HOME") 24 default: 25 homeDir = os.Getenv("HOME") 26 } 27 return homeDir 28 }