From d7216020c64f583fa9add4544afc78d42c9f43aa Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 7 Aug 2024 15:49:14 +0200 Subject: [PATCH] Use default user's cache dir instead of tmp for build cache --- internal/cli/configuration/configuration.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/cli/configuration/configuration.go b/internal/cli/configuration/configuration.go index 571ed155061..134efdfdaf6 100644 --- a/internal/cli/configuration/configuration.go +++ b/internal/cli/configuration/configuration.go @@ -103,7 +103,14 @@ func getDefaultUserDir() string { // getDefaultBuildCacheDir returns the full path to the default build cache folder func getDefaultBuildCacheDir() string { - return paths.TempDir().Join("arduino").String() + var cacheDir *paths.Path + if p, err := os.UserCacheDir(); err == nil { + cacheDir = paths.New(p) + } else { + // fallback to /tmp + cacheDir = paths.TempDir() + } + return cacheDir.Join("arduino").String() } // FindConfigFlagsInArgsOrFallbackOnEnv returns the config file path using the