@@ -178,19 +178,23 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
178
178
s .settings .GetCompilationsBeforeBuildCachePurge (),
179
179
s .settings .GetBuildCacheTTL ().Abs ())
180
180
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 ()
186
184
if err != nil {
187
185
return & cmderrors.PermissionDeniedError {Message : i18n .Tr ("Cannot create build cache directory" ), Cause : err }
188
186
}
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 }
193
195
}
196
+ coreBuildCachePath := buildCachePath .Join ("cores" )
197
+
194
198
var extraCoreBuildCachePaths paths.PathList
195
199
if len (req .GetBuildCacheExtraPaths ()) == 0 {
196
200
extraCoreBuildCachePaths = s .settings .GetBuildCacheExtraPaths ()
0 commit comments