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