diff options
author | Ayke van Laethem <[email protected]> | 2019-04-27 17:28:21 +0200 |
---|---|---|
committer | Ron Evans <[email protected]> | 2019-04-30 20:04:04 +0200 |
commit | 5b0b35f9e40e40bcbac0b11aebe4e4686bdd87b1 (patch) | |
tree | 604918d9dbbd7ef39d16bdbe980eff78502e0433 /buildcache.go | |
parent | 9a3d0683b34f9f030e1d0323bea849d56054cdec (diff) | |
download | tinygo-5b0b35f9e40e40bcbac0b11aebe4e4686bdd87b1.tar.gz tinygo-5b0b35f9e40e40bcbac0b11aebe4e4686bdd87b1.zip |
main: use os.UserCacheDir to get a cache directory
This is more portable than assuming the cache directory lies at
~/.cache.
Diffstat (limited to 'buildcache.go')
-rw-r--r-- | buildcache.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/buildcache.go b/buildcache.go index eb8fd2ea8..4b6c63ab7 100644 --- a/buildcache.go +++ b/buildcache.go @@ -9,9 +9,11 @@ import ( // Get the cache directory, usually ~/.cache/tinygo func cacheDir() string { - home := getHomeDir() - dir := filepath.Join(home, ".cache", "tinygo") - return dir + dir, err := os.UserCacheDir() + if err != nil { + panic("could not find cache dir: " + err.Error()) + } + return filepath.Join(dir, "tinygo") } // Return the newest timestamp of all the file paths passed in. Used to check |