mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 23:13:40 +00:00
main: use os.UserCacheDir to get a cache directory
This is more portable than assuming the cache directory lies at ~/.cache.
This commit is contained in:
committed by
Ron Evans
parent
9a3d0683b3
commit
5b0b35f9e4
+5
-3
@@ -9,9 +9,11 @@ import (
|
|||||||
|
|
||||||
// Get the cache directory, usually ~/.cache/tinygo
|
// Get the cache directory, usually ~/.cache/tinygo
|
||||||
func cacheDir() string {
|
func cacheDir() string {
|
||||||
home := getHomeDir()
|
dir, err := os.UserCacheDir()
|
||||||
dir := filepath.Join(home, ".cache", "tinygo")
|
if err != nil {
|
||||||
return dir
|
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
|
// Return the newest timestamp of all the file paths passed in. Used to check
|
||||||
|
|||||||
Reference in New Issue
Block a user