package xdg

import (
	
	
	
	
	
)

// 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
}