mirror of
https://github.com/rsteube/carapace-bin.git
synced 2025-05-05 15:32:53 +00:00
tmp
This commit is contained in:
parent
4be149105a
commit
3b82a99d98
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user