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