@@ -165,7 +165,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
165165 if buildPathArg := req .GetBuildPath (); buildPathArg != "" {
166166 buildPath = paths .New (req .GetBuildPath ()).Canonical ()
167167 if in , _ := buildPath .IsInsideDir (sk .FullPath ); in && buildPath .IsDir () {
168- if sk .AdditionalFiles , err = removeBuildFromSketchFiles (sk .AdditionalFiles , buildPath ); err != nil {
168+ if sk .AdditionalFiles , err = removeBuildPathFromSketchFiles (sk .AdditionalFiles , buildPath ); err != nil {
169169 return err
170170 }
171171 }
@@ -434,15 +434,15 @@ func maybePurgeBuildCache(compilationsBeforePurge uint, cacheTTL time.Duration)
434434 buildcache .New (paths .TempDir ().Join ("arduino" , "sketches" )).Purge (cacheTTL )
435435}
436436
437- // removeBuildFromSketchFiles removes the files contained in the build directory from
437+ // removeBuildPathFromSketchFiles removes the files contained in the build directory from
438438// the list of the sketch files
439- func removeBuildFromSketchFiles (files paths.PathList , build * paths.Path ) (paths.PathList , error ) {
439+ func removeBuildPathFromSketchFiles (files paths.PathList , build * paths.Path ) (paths.PathList , error ) {
440440 var res paths.PathList
441441 ignored := false
442442 for _ , file := range files {
443443 if isInside , _ := file .IsInsideDir (build ); ! isInside {
444- res = append ( res , file )
445- } else if ! ignored {
444+ res . Add ( file )
445+ } else {
446446 ignored = true
447447 }
448448 }
0 commit comments