Source File
xdg.go
Belonging Package
github.com/carapace-sh/carapace/pkg/xdg
package xdgimport ()// UserCacheDir returns the user cache base directory.func () ( string, error) {if = os.Getenv("XDG_CACHE_HOME"); == "" || !filepath.IsAbs() {, = os.UserCacheDir()}= filepath.ToSlash()return}// UserConfigDir returns the user config base directory.func () ( string, error) {if = os.Getenv("XDG_CONFIG_HOME"); == "" || !filepath.IsAbs() {, = os.UserConfigDir()}= filepath.ToSlash()return}// ConfigDirs returns the global config base directories.func () ( []string, error) {switch runtime.GOOS {case "windows":, := os.LookupEnv("PROGRAMDATA")if ! {return nil, errors.New("missing PROGRAMDATA environment variable")}= append(, )case "darwin":= append(, "/Library/Application Support")default:= append(, "/etc/xdg")}if , := os.LookupEnv("XDG_CONFIG_DIRS"); {:= make([]string, 0)for , := range strings.Split(, string(os.PathSeparator)) {if filepath.IsAbs() {= append(, )}}= append(, ...)}for , := range {[] = filepath.ToSlash()}return}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |