Skip to content

Commit 1b6d3ed

Browse files
committed
[breaking] --build-cache-path now saves under 'cores' subdir instead of 'core'
1 parent 8687f9d commit 1b6d3ed

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

commands/service_compile.go

+13-9
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,23 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
178178
s.settings.GetCompilationsBeforeBuildCachePurge(),
179179
s.settings.GetBuildCacheTTL().Abs())
180180

181-
var coreBuildCachePath *paths.Path
182-
if req.GetBuildCachePath() == "" {
183-
coreBuildCachePath = paths.TempDir().Join("arduino", "cores")
184-
} else {
185-
buildCachePath, err := paths.New(req.GetBuildCachePath()).Abs()
181+
var buildCachePath *paths.Path
182+
if req.GetBuildCachePath() != "" {
183+
p, err := paths.New(req.GetBuildCachePath()).Abs()
186184
if err != nil {
187185
return &cmderrors.PermissionDeniedError{Message: i18n.Tr("Cannot create build cache directory"), Cause: err}
188186
}
189-
if err := buildCachePath.MkdirAll(); err != nil {
190-
return &cmderrors.PermissionDeniedError{Message: i18n.Tr("Cannot create build cache directory"), Cause: err}
191-
}
192-
coreBuildCachePath = buildCachePath.Join("core")
187+
buildCachePath = p
188+
} else if p, ok := s.settings.GetBuildCachePath(); ok {
189+
buildCachePath = p
190+
} else {
191+
buildCachePath = paths.TempDir().Join("arduino")
192+
}
193+
if err := buildCachePath.MkdirAll(); err != nil {
194+
return &cmderrors.PermissionDeniedError{Message: i18n.Tr("Cannot create build cache directory"), Cause: err}
193195
}
196+
coreBuildCachePath := buildCachePath.Join("cores")
197+
194198
var extraCoreBuildCachePaths paths.PathList
195199
if len(req.GetBuildCacheExtraPaths()) == 0 {
196200
extraCoreBuildCachePaths = s.settings.GetBuildCacheExtraPaths()

0 commit comments

Comments
 (0)