MCPcopy
hub / github.com/zarf-dev/zarf / ResolveCachePath

Function ResolveCachePath

src/pkg/utils/io.go:22–31  ·  view source on GitHub ↗

ResolveCachePath returns cachePath if non-empty, otherwise falls back to filepath.Join(os.UserCacheDir(), "zarf") which respects XDG_CACHE_HOME on Linux.

(cachePath string)

Source from the content-addressed store, hash-verified

20// ResolveCachePath returns cachePath if non-empty, otherwise falls back to
21// filepath.Join(os.UserCacheDir(), "zarf") which respects XDG_CACHE_HOME on Linux.
22func 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.
34func MakeTempDir(basePath string) (string, error) {

Callers 11

DevDeployFunction · 0.92
LintFunction · 0.92
PullFunction · 0.92
LoadPackageFunction · 0.92
FindDefinitionImagesFunction · 0.92
FindImagesFunction · 0.92
CreateFunction · 0.92
PublishSkeletonFunction · 0.92
PackageDefinitionFunction · 0.92
TestResolveCachePathFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestResolveCachePathFunction · 0.68