@@ -165,7 +165,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
165
165
if buildPathArg := req .GetBuildPath (); buildPathArg != "" {
166
166
buildPath = paths .New (req .GetBuildPath ()).Canonical ()
167
167
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 {
169
169
return err
170
170
}
171
171
}
@@ -434,15 +434,15 @@ func maybePurgeBuildCache(compilationsBeforePurge uint, cacheTTL time.Duration)
434
434
buildcache .New (paths .TempDir ().Join ("arduino" , "sketches" )).Purge (cacheTTL )
435
435
}
436
436
437
- // removeBuildFromSketchFiles removes the files contained in the build directory from
437
+ // removeBuildPathFromSketchFiles removes the files contained in the build directory from
438
438
// 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 ) {
440
440
var res paths.PathList
441
441
ignored := false
442
442
for _ , file := range files {
443
443
if isInside , _ := file .IsInsideDir (build ); ! isInside {
444
- res = append ( res , file )
445
- } else if ! ignored {
444
+ res . Add ( file )
445
+ } else {
446
446
ignored = true
447
447
}
448
448
}
0 commit comments