ResolveCachePath returns cachePath if non-empty, otherwise falls back to filepath.Join(os.UserCacheDir(), "zarf") which respects XDG_CACHE_HOME on Linux.
(cachePath string)
| 20 | // ResolveCachePath returns cachePath if non-empty, otherwise falls back to |
| 21 | // filepath.Join(os.UserCacheDir(), "zarf") which respects XDG_CACHE_HOME on Linux. |
| 22 | func ResolveCachePath(cachePath string) (string, error) { |
| 23 | if cachePath != "" { |
| 24 | return cachePath, nil |
| 25 | } |
| 26 | cacheDir, err := os.UserCacheDir() |
| 27 | if err != nil { |
| 28 | return "", fmt.Errorf("unable to determine cache directory: %w", err) |
| 29 | } |
| 30 | return filepath.Join(cacheDir, "zarf"), nil |
| 31 | } |
| 32 | |
| 33 | // MakeTempDir creates a temp directory with the zarf- prefix. |
| 34 | func MakeTempDir(basePath string) (string, error) { |
no outgoing calls