Skip to content

Commit d721602

Browse files
committed
Use default user's cache dir instead of tmp for build cache
1 parent b4d9171 commit d721602

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

internal/cli/configuration/configuration.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,14 @@ func getDefaultUserDir() string {
103103

104104
// getDefaultBuildCacheDir returns the full path to the default build cache folder
105105
func getDefaultBuildCacheDir() string {
106-
return paths.TempDir().Join("arduino").String()
106+
var cacheDir *paths.Path
107+
if p, err := os.UserCacheDir(); err == nil {
108+
cacheDir = paths.New(p)
109+
} else {
110+
// fallback to /tmp
111+
cacheDir = paths.TempDir()
112+
}
113+
return cacheDir.Join("arduino").String()
107114
}
108115

109116
// FindConfigFlagsInArgsOrFallbackOnEnv returns the config file path using the

0 commit comments

Comments
 (0)