()
| 40 | } |
| 41 | |
| 42 | func XDGConfigHome() (string, error) { |
| 43 | if xch := os.Getenv("XDG_CONFIG_HOME"); xch != "" { |
| 44 | return xch, nil |
| 45 | } |
| 46 | // Fall back to "~/.config" |
| 47 | // Note that We cannot rely on user.Current().HomeDir because we might be inside UserNS. |
| 48 | home := os.Getenv("HOME") |
| 49 | if home == "" { |
| 50 | return "", errors.New("environment variable HOME is not set") |
| 51 | } |
| 52 | return filepath.Join(home, ".config"), nil |
| 53 | } |
| 54 | |
| 55 | func XDGDataHome() (string, error) { |
| 56 | if xdh := os.Getenv("XDG_DATA_HOME"); xdh != "" { |
no outgoing calls
no test coverage detected
searching dependent graphs…