github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/util/configv3/home_dir.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(homeDirectory(), ".cf", "config.json")
    13  }
    14  
    15  func homeDirectory() string {
    16  	var homeDir string
    17  	switch {
    18  	case os.Getenv("CF_HOME") != "":
    19  		homeDir = os.Getenv("CF_HOME")
    20  	default:
    21  		homeDir = os.Getenv("HOME")
    22  	}
    23  	return homeDir
    24  }