Skip to content

Commit d95a3df

Browse files
committed
Slight improvement of removeBuildFromSketchFiles
1 parent d69a762 commit d95a3df

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
@@ -165,7 +165,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
165165
if buildPathArg := req.GetBuildPath(); buildPathArg != "" {
166166
buildPath = paths.New(req.GetBuildPath()).Canonical()
167167
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 {
169169
return err
170170
}
171171
}
@@ -434,15 +434,15 @@ func maybePurgeBuildCache(compilationsBeforePurge uint, cacheTTL time.Duration)
434434
buildcache.New(paths.TempDir().Join("arduino", "sketches")).Purge(cacheTTL)
435435
}
436436

437-
// removeBuildFromSketchFiles removes the files contained in the build directory from
437+
// removeBuildPathFromSketchFiles removes the files contained in the build directory from
438438
// 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) {
440440
var res paths.PathList
441441
ignored := false
442442
for _, file := range files {
443443
if isInside, _ := file.IsInsideDir(build); !isInside {
444-
res = append(res, file)
445-
} else if !ignored {
444+
res.Add(file)
445+
} else {
446446
ignored = true
447447
}
448448
}

0 commit comments

Comments
 (0)