@@ -168,7 +168,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
168
168
if buildPathArg := req .GetBuildPath (); buildPathArg != "" {
169
169
buildPath = paths .New (req .GetBuildPath ()).Canonical ()
170
170
if in , _ := buildPath .IsInsideDir (sk .FullPath ); in && buildPath .IsDir () {
171
- if sk .AdditionalFiles , err = removeBuildFromSketchFiles (sk .AdditionalFiles , buildPath ); err != nil {
171
+ if sk .AdditionalFiles , err = removeBuildPathFromSketchFiles (sk .AdditionalFiles , buildPath ); err != nil {
172
172
return err
173
173
}
174
174
}
@@ -461,15 +461,15 @@ func maybePurgeBuildCache(compilationsBeforePurge uint, cacheTTL time.Duration)
461
461
buildcache .New (paths .TempDir ().Join ("arduino" , "sketches" )).Purge (cacheTTL )
462
462
}
463
463
464
- // removeBuildFromSketchFiles removes the files contained in the build directory from
464
+ // removeBuildPathFromSketchFiles removes the files contained in the build directory from
465
465
// the list of the sketch files
466
- func removeBuildFromSketchFiles (files paths.PathList , build * paths.Path ) (paths.PathList , error ) {
466
+ func removeBuildPathFromSketchFiles (files paths.PathList , build * paths.Path ) (paths.PathList , error ) {
467
467
var res paths.PathList
468
468
ignored := false
469
469
for _ , file := range files {
470
470
if isInside , _ := file .IsInsideDir (build ); ! isInside {
471
- res = append ( res , file )
472
- } else if ! ignored {
471
+ res . Add ( file )
472
+ } else {
473
473
ignored = true
474
474
}
475
475
}
0 commit comments