Codebase list golang-github-kyoh86-xdg / fresh-snapshots/main runtime_other.go
fresh-snapshots/main

Tree @fresh-snapshots/main (Download .tar.gz)

runtime_other.go @fresh-snapshots/mainraw · history · blame

// +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())),
	)
}