github.1485827954.workers.dev/nektos/act@v0.2.63/cmd/dir.go (about)

     1  package cmd
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  
     7  	log "github.com/sirupsen/logrus"
     8  )
     9  
    10  var (
    11  	UserHomeDir  string
    12  	CacheHomeDir string
    13  )
    14  
    15  func init() {
    16  	home, err := os.UserHomeDir()
    17  	if err != nil {
    18  		log.Fatal(err)
    19  	}
    20  	UserHomeDir = home
    21  
    22  	if v := os.Getenv("XDG_CACHE_HOME"); v != "" {
    23  		CacheHomeDir = v
    24  	} else {
    25  		CacheHomeDir = filepath.Join(UserHomeDir, ".cache")
    26  	}
    27  }