Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Apr 10, 2024
1 parent 89c9bd4 commit 6ec0e1d
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions pkg/actions/tools/molecule/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 6ec0e1d

Please sign in to comment.