Skip to content

Commit eff390d

Browse files
committed
Slight improvement of removeBuildFromSketchFiles
1 parent a94f938 commit eff390d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

commands/service_compile.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
167167
if buildPathArg := req.GetBuildPath(); buildPathArg != "" {
168168
buildPath = paths.New(req.GetBuildPath()).Canonical()
169169
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 {
171171
return err
172172
}
173173
}
@@ -453,15 +453,15 @@ func maybePurgeBuildCache(compilationsBeforePurge uint, cacheTTL time.Duration)
453453
buildcache.New(paths.TempDir().Join("arduino", "sketches")).Purge(cacheTTL)
454454
}
455455

456-
// removeBuildFromSketchFiles removes the files contained in the build directory from
456+
// removeBuildPathFromSketchFiles removes the files contained in the build directory from
457457
// 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) {
459459
var res paths.PathList
460460
ignored := false
461461
for _, file := range files {
462462
if isInside, _ := file.IsInsideDir(build); !isInside {
463-
res = append(res, file)
464-
} else if !ignored {
463+
res.Add(file)
464+
} else {
465465
ignored = true
466466
}
467467
}

0 commit comments

Comments
 (0)