File: runtime_other.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 (18 lines) | stat: -rw-r--r-- 295 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// +build !windows,!darwin

package xdg

import (
	"os"
	"path/filepath"
	"strconv"
)

// RuntimeDir returns XDG runtime directory.
func RuntimeDir() string {
	// XDG_RUNTIME_DIR
	return alternate(
		os.Getenv(RuntimeDirEnv),
		filepath.Join("/", "run", "user", strconv.Itoa(os.Getuid())),
	)
}