gitlab.com/SiaPrime/SiaPrime@v1.4.1/build/appdata.go (about)

     1  package build
     2  
     3  import (
     4  	"os"
     5  	"path/filepath"
     6  	"runtime"
     7  )
     8  
     9  // DefaultSiaDir returns the default data directory of siad. The values for
    10  // supported operating systems are:
    11  //
    12  // Linux:   $HOME/.sia
    13  // MacOS:   $HOME/Library/Application Support/Sia
    14  // Windows: %LOCALAPPDATA%\Sia
    15  func DefaultSiaDir() string {
    16  	switch runtime.GOOS {
    17  	case "windows":
    18  		return filepath.Join(os.Getenv("LOCALAPPDATA"), "SiaPrime")
    19  	case "darwin":
    20  		return filepath.Join(os.Getenv("HOME"), "Library", "Application Support", "SiaPrime")
    21  	default:
    22  		return filepath.Join(os.Getenv("HOME"), ".siaprime")
    23  	}
    24  }
    25  
    26  // APIPasswordFile returns the path to the API's password file given a Sia
    27  // directory.
    28  func APIPasswordFile(siaDir string) string {
    29  	return filepath.Join(siaDir, "apipassword")
    30  }