Skip to content

Commit 257b306

Browse files
committed
Slight improvement of removeBuildFromSketchFiles
1 parent e61c935 commit 257b306

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
@@ -168,7 +168,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
168168
if buildPathArg := req.GetBuildPath(); buildPathArg != "" {
169169
buildPath = paths.New(req.GetBuildPath()).Canonical()
170170
if in, _ := buildPath.IsInsideDir(sk.FullPath); in && buildPath.IsDir() {
171-
if sk.AdditionalFiles, err = removeBuildFromSketchFiles(sk.AdditionalFiles, buildPath); err != nil {
171+
if sk.AdditionalFiles, err = removeBuildPathFromSketchFiles(sk.AdditionalFiles, buildPath); err != nil {
172172
return err
173173
}
174174
}
@@ -461,15 +461,15 @@ func maybePurgeBuildCache(compilationsBeforePurge uint, cacheTTL time.Duration)
461461
buildcache.New(paths.TempDir().Join("arduino", "sketches")).Purge(cacheTTL)
462462
}
463463

464-
// removeBuildFromSketchFiles removes the files contained in the build directory from
464+
// removeBuildPathFromSketchFiles removes the files contained in the build directory from
465465
// the list of the sketch files
466-
func removeBuildFromSketchFiles(files paths.PathList, build *paths.Path) (paths.PathList, error) {
466+
func removeBuildPathFromSketchFiles(files paths.PathList, build *paths.Path) (paths.PathList, error) {
467467
var res paths.PathList
468468
ignored := false
469469
for _, file := range files {
470470
if isInside, _ := file.IsInsideDir(build); !isInside {
471-
res = append(res, file)
472-
} else if !ignored {
471+
res.Add(file)
472+
} else {
473473
ignored = true
474474
}
475475
}

0 commit comments

Comments
 (0)