File: app_darwin.go

package info (click to toggle)
golang-github-apparentlymart-go-userdirs 0.0~git20200915.b0c018a-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 184 kB
  • sloc: makefile: 2
file content (29 lines) | stat: -rw-r--r-- 824 bytes parent folder | download
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
26
27
28
29
// +build darwin

package userdirs

import (
	"path/filepath"

	"github.com/apparentlymart/go-userdirs/macosbase"
)

func supportedOS() bool {
	return true
}

func forApp(name string, vendor string, bundleID string) Dirs {
	appSupportDir := filepath.Join(macosbase.ApplicationSupportDir(), bundleID)
	cachesDir := filepath.Join(macosbase.CachesDir(), bundleID)
	globalAppSupportDir := filepath.Join("/", "Library", "Application Support", bundleID)

	return Dirs{
		// NOTE: We don't use "Preferences" here because it is specified as
		// containing propertly list files managed by an OS framework API only,
		// so it would not be appropriate to read/write arbitrary config
		// files in there.
		ConfigDirs: []string{appSupportDir},
		DataDirs:   []string{appSupportDir, globalAppSupportDir},
		CacheDir:   cachesDir,
	}
}