github.com/elopio/cli@v6.21.2-0.20160902224010-ea909d1fdb2f+incompatible/utils/config/home_dir.go (about)

     1  // +build !windows
     2  
     3  package config
     4  
     5  import (
     6  	"os"
     7  	"path/filepath"
     8  )
     9  
    10  func homeDirectory() string {
    11  	var homeDir string
    12  	switch {
    13  	case os.Getenv("CF_HOME") != "":
    14  		homeDir = os.Getenv("CF_HOME")
    15  	default:
    16  		homeDir = os.Getenv("HOME")
    17  	}
    18  	return homeDir
    19  }
    20  
    21  // DefaultFilePath returns the location of the config file
    22  func defaultFilePath() string {
    23  	return filepath.Join(homeDirectory(), ".cf", "config.json")
    24  }