File: config_darwin.go

package info (click to toggle)
golang-github-kyoh86-xdg 1.2.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: makefile: 13
file content (25 lines) | stat: -rw-r--r-- 530 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// +build darwin

package xdg

import (
	"os"
	"path/filepath"
)

// ConfigHome returns a user XDG configuration directory (XDG_CONFIG_HOME).
func ConfigHome() string {
	return altHome(os.Getenv(ConfigHomeEnv), "Library", "Preferences")
}

// ConfigDirs returns system XDG data directories (XDG_CONFIG_DIRS).
func ConfigDirs() []string {
	// XDG_CONFIG_DIRS
	xdgDirs := filepath.SplitList(os.Getenv(ConfigDirsEnv))
	if len(xdgDirs) != 0 {
		return xdgDirs
	}
	return []string{
		filepath.Join("/", "Library", "Preferences"),
	}
}