mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-12-28 20:39:40 -08:00
feat(shell): allow user to specify the cache path with OMP_CACHE_DIR
resolves #4321
This commit is contained in:
parent
0cfe9a7423
commit
e15a797640
|
@ -100,14 +100,22 @@ func (env *Shell) Platform() string {
|
|||
|
||||
func (env *Shell) CachePath() string {
|
||||
defer env.Trace(time.Now())
|
||||
|
||||
// allow the user to set the cache path using OMP_CACHE_DIR
|
||||
if cachePath := returnOrBuildCachePath(env.Getenv("OMP_CACHE_DIR")); len(cachePath) != 0 {
|
||||
return cachePath
|
||||
}
|
||||
|
||||
// get XDG_CACHE_HOME if present
|
||||
if cachePath := returnOrBuildCachePath(env.Getenv("XDG_CACHE_HOME")); len(cachePath) != 0 {
|
||||
return cachePath
|
||||
}
|
||||
|
||||
// HOME cache folder
|
||||
if cachePath := returnOrBuildCachePath(env.Home() + "/.cache"); len(cachePath) != 0 {
|
||||
return cachePath
|
||||
}
|
||||
|
||||
return env.Home()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue