MCPcopy Create free account
hub / github.com/containerd/nerdctl / XDGRuntimeDir

Function XDGRuntimeDir

pkg/rootlessutil/xdg_linux.go:27–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25)
26
27func XDGRuntimeDir() (string, error) {
28 if xrd := os.Getenv("XDG_RUNTIME_DIR"); xrd != "" {
29 return xrd, nil
30 }
31 // Fall back to "/run/user/<euid>".
32 // Note that We cannot rely on os.Geteuid() because we might be inside UserNS.
33 if parentEuid, ok := os.LookupEnv("ROOTLESSKIT_PARENT_EUID"); ok {
34 if _, err := strconv.Atoi(parentEuid); err != nil {
35 return "", fmt.Errorf("invalid ROOTLESSKIT_PARENT_EUID environment variable value %q: %w", parentEuid, err)
36 }
37 return "/run/user/" + parentEuid, nil
38 }
39 return "", errors.New("environment variable XDG_RUNTIME_DIR is not set, see https://rootlesscontaine.rs/getting-started/common/login/")
40}
41
42func XDGConfigHome() (string, error) {
43 if xch := os.Getenv("XDG_CONFIG_HOME"); xch != "" {

Callers 1

RootlessKitStateDirFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…