github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/pkg/cli/cli_windows.go (about)

     1  package cli
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  )
     7  
     8  func defaultAgentConfigPath() string {
     9  	return filepath.Join(getInstallPrefix(), `Pyroscope Agent`, "agent.yml")
    10  }
    11  
    12  func defaultAgentLogFilePath() string {
    13  	return filepath.Join(getDataDirectory(), `Pyroscope Agent`, "pyroscope-agent.log")
    14  }
    15  
    16  func getInstallPrefix() string {
    17  	return `C:\Program Files\Pyroscope`
    18  }
    19  
    20  func getDataDirectory() string {
    21  	p, ok := os.LookupEnv("PROGRAMDATA")
    22  	if ok {
    23  		return filepath.Join(p, `Pyroscope`)
    24  	}
    25  	e, err := os.Executable()
    26  	if err == nil {
    27  		return filepath.Dir(e)
    28  	}
    29  	return filepath.Dir(os.Args[0])
    30  }