Skip to content

Commit c1b9a59

Browse files
committed
Enhance platform loading step
1 parent 9104010 commit c1b9a59

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

arduino/cores/packagemanager/loader.go

+7-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"fmt"
2020
"os"
2121
"path/filepath"
22-
"strings"
2322

2423
"github.com/arduino/arduino-cli/arduino/cores"
2524
"github.com/arduino/arduino-cli/configuration"
@@ -163,7 +162,13 @@ func (pm *PackageManager) loadPlatforms(targetPackage *cores.Package, packageDir
163162

164163
// A platform can only be inside a directory, thus we skip everything else.
165164
platformsDirs.FilterDirs()
165+
// Filter out directories like .git and similar things
166+
platformsDirs.FilterOutPrefix(".")
166167
for _, platformPath := range platformsDirs {
168+
// Tools are not a platform
169+
if platformPath.Base() == "tools" {
170+
continue
171+
}
167172
if err := pm.loadPlatform(targetPackage, platformPath); err != nil {
168173
statuses = append(statuses, err)
169174
}
@@ -178,13 +183,10 @@ func (pm *PackageManager) loadPlatforms(targetPackage *cores.Package, packageDir
178183
func (pm *PackageManager) loadPlatform(targetPackage *cores.Package, platformPath *paths.Path) *status.Status {
179184
// This is not a platform
180185
if platformPath.IsNotDir() {
181-
return nil
186+
return status.Newf(codes.NotFound, "path is not a platform directory: %s", platformPath)
182187
}
183188

184189
architecture := platformPath.Base()
185-
if strings.HasPrefix(architecture, ".") || architecture == "tools" {
186-
return nil
187-
}
188190

189191
// There are two possible platform directory structures:
190192
// - ARCHITECTURE/boards.txt

0 commit comments

Comments
 (0)