Skip to content

Commit

Permalink
installer/pkg/config/libvirt/cache: Stub in $XDG_CACHE_HOME
Browse files Browse the repository at this point in the history
Assume the caller has HOME set and XDG_CACHE_HOME not set, because
that's easy.  The ~/.cache default is from [1].  Once we bump to Go
1.11, we can revert this commit and get the more-robust stdlib
implementation, which is why I haven't bothered with a robust
implementation here.

[1]: https://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html
  • Loading branch information
wking committed Sep 19, 2018
1 parent 9ca81bb commit 04d2575
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions installer/pkg/config/libvirt/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ func (libvirt *Libvirt) UseCachedImage() (err error) {
return nil
}

baseCacheDir, err := os.UserCacheDir()
if err != nil {
return err
}
// FIXME: Use os.UserCacheDir() once we bump to Go 1.11
// baseCacheDir, err := os.UserCacheDir()
// if err != nil {
// return err
// }
baseCacheDir := filepath.Join(os.Getenv("HOME"), ".cache")

cacheDir := filepath.Join(baseCacheDir, "openshift-install", "libvirt")
err = os.MkdirAll(cacheDir, 0777)
Expand Down

0 comments on commit 04d2575

Please sign in to comment.