Based on https://github.com/adrg/xdg Licensed under MIT License (MIT) Copyright (c) 2014 Adrian-George Bostan <adrg@epistack.com>
()
| 29 | // Copyright (c) 2014 Adrian-George Bostan <adrg@epistack.com> |
| 30 | |
| 31 | func osDependentRunDir() (string, error) { |
| 32 | run := filepath.Join("run", "user", strconv.Itoa(os.Getuid())) |
| 33 | if _, err := os.Stat(run); err == nil { |
| 34 | return run, nil |
| 35 | } |
| 36 | |
| 37 | // /run/user/$uid is set by pam_systemd, but might not be present, especially in containerized environments |
| 38 | home, err := os.UserHomeDir() |
| 39 | if err != nil { |
| 40 | return "", err |
| 41 | } |
| 42 | return filepath.Join(home, ".docker", "docker-compose"), nil |
| 43 | } |