From 6ec0e1dd6396efe3a8f22b84801c834f0724c856 Mon Sep 17 00:00:00 2001 From: rsteube Date: Wed, 10 Apr 2024 12:49:42 +0200 Subject: [PATCH] tmp --- pkg/actions/tools/molecule/host.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/pkg/actions/tools/molecule/host.go b/pkg/actions/tools/molecule/host.go index 06fe531a96..28d2e8805f 100644 --- a/pkg/actions/tools/molecule/host.go +++ b/pkg/actions/tools/molecule/host.go @@ -6,6 +6,7 @@ import ( "github.com/carapace-sh/carapace" "github.com/carapace-sh/carapace/pkg/traverse" + "github.com/carapace-sh/carapace/pkg/xdg" "gopkg.in/yaml.v3" ) @@ -58,18 +59,11 @@ func traverseEphemeralDir(envFilePath string) func(tc traverse.Context) (string, // Find the location molecule is storing ephemeral data func getMoleculeEphemeralDir(envFilePath string) string { - // Default to the platform equivalent to "$HOME" joined with .cache/molecule" - // (molecule does not support windows) - ephemeralPath, err := os.UserHomeDir() + cacheDir, err := xdg.UserCacheDir() if err != nil { - return "" - } - ephemeralPath = path.Join(ephemeralPath, ".cache", "molecule") - - // Check for more specific cache directory environment variable - if cacheHome, ok := os.LookupEnv("XDG_CACHE_HOME"); ok { - ephemeralPath = path.Join(cacheHome, "molecule") + return "" // TODO error } + ephemeralPath := path.Join(cacheDir, "molecule") // Check for specific molecule environment variable if moleculeEphemeral, ok := os.LookupEnv("MOLECULE_EPHEMERAL_DIRECTORY"); ok {