Skip to content

Commit

Permalink
Use default user's cache dir instead of tmp for build cache
Browse files Browse the repository at this point in the history
  • Loading branch information
cmaglie committed Aug 7, 2024
1 parent 6c6626d commit e832dd3
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/cli/configuration/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e832dd3

Please sign in to comment.