@@ -168,7 +168,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
168168 if buildPathArg := req .GetBuildPath (); buildPathArg != "" {
169169 buildPath = paths .New (req .GetBuildPath ()).Canonical ()
170170 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 {
172172 return err
173173 }
174174 }
@@ -461,15 +461,15 @@ func maybePurgeBuildCache(compilationsBeforePurge uint, cacheTTL time.Duration)
461461 buildcache .New (paths .TempDir ().Join ("arduino" , "sketches" )).Purge (cacheTTL )
462462}
463463
464- // removeBuildFromSketchFiles removes the files contained in the build directory from
464+ // removeBuildPathFromSketchFiles removes the files contained in the build directory from
465465// 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 ) {
467467 var res paths.PathList
468468 ignored := false
469469 for _ , file := range files {
470470 if isInside , _ := file .IsInsideDir (build ); ! isInside {
471- res = append ( res , file )
472- } else if ! ignored {
471+ res . Add ( file )
472+ } else {
473473 ignored = true
474474 }
475475 }
0 commit comments