1// +build !windows,!darwin
2
3package configdir
4
5import (
6	"os"
7	"path/filepath"
8	"strings"
9)
10
11var (
12	systemConfig []string
13	localConfig  string
14	localCache   string
15)
16
17func findPaths() {
18	// System-wide configuration.
19	if os.Getenv("XDG_CONFIG_DIRS") != "" {
20		systemConfig = strings.Split(os.Getenv("XDG_CONFIG_DIRS"), ":")
21	} else {
22		systemConfig = []string{"/etc/xdg"}
23	}
24
25	// Local user configuration.
26	if os.Getenv("XDG_CONFIG_HOME") != "" {
27		localConfig = os.Getenv("XDG_CONFIG_HOME")
28	} else {
29		localConfig = filepath.Join(os.Getenv("HOME"), ".config")
30	}
31
32	// Local user cache.
33	if os.Getenv("XDG_CACHE_HOME") != "" {
34		localCache = os.Getenv("XDG_CACHE_HOME")
35	} else {
36		localCache = filepath.Join(os.Getenv("HOME"), ".cache")
37	}
38}
39