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