@@ -34,8 +34,6 @@ import (
34
34
35
35
"github.com/arduino/arduino-builder/i18n"
36
36
"github.com/arduino/arduino-builder/types"
37
- "github.com/arduino/arduino-builder/utils"
38
- "github.com/arduino/go-paths-helper"
39
37
"github.com/bcmi-labs/arduino-cli/arduino/libraries"
40
38
)
41
39
@@ -48,21 +46,19 @@ func (s *LibrariesLoader) Run(ctx *types.Context) error {
48
46
}
49
47
sortedLibrariesFolders := builtInLibrariesFolders .Clone ()
50
48
49
+ actualPlatform := ctx .ActualPlatform
51
50
platform := ctx .TargetPlatform
52
51
debugLevel := ctx .DebugLevel
53
52
logger := ctx .GetLogger ()
54
53
55
- actualPlatform := ctx .ActualPlatform
56
54
if actualPlatform != platform {
57
- actualPlatformLibDir := paths .New (actualPlatform .Folder ).Join ("libraries" )
58
- if isDir , _ := actualPlatformLibDir .IsDir (); isDir {
59
- sortedLibrariesFolders .Add (actualPlatformLibDir )
55
+ if dir := actualPlatform .GetLibrariesDir (); dir != nil {
56
+ sortedLibrariesFolders .Add (dir )
60
57
}
61
58
}
62
59
63
- platformLibDir := paths .New (platform .Folder ).Join ("libraries" )
64
- if isDir , _ := platformLibDir .IsDir (); isDir {
65
- sortedLibrariesFolders .Add (platformLibDir )
60
+ if dir := platform .GetLibrariesDir (); dir != nil {
61
+ sortedLibrariesFolders .Add (dir )
66
62
}
67
63
68
64
librariesFolders := ctx .OtherLibrariesFolders
@@ -97,12 +93,13 @@ func (s *LibrariesLoader) Run(ctx *types.Context) error {
97
93
98
94
headerToLibraries := make (map [string ][]* libraries.Library )
99
95
for _ , library := range libs {
100
- headers , err := utils . ReadDirFiltered ( library .SrcFolder .String (), utils . FilterFilesWithExtensions ( ".h" , ".hpp" , ".hh" ) )
96
+ headers , err := library .SrcFolder .ReadDir ( )
101
97
if err != nil {
102
98
return i18n .WrapError (err )
103
99
}
100
+ headers .FilterSuffix (".h" , ".hpp" , ".hh" )
104
101
for _ , header := range headers {
105
- headerFileName := header .Name ()
102
+ headerFileName := header .Base ()
106
103
headerToLibraries [headerFileName ] = append (headerToLibraries [headerFileName ], library )
107
104
}
108
105
}
0 commit comments