@@ -48,8 +48,7 @@ func LibraryList(ctx context.Context, req *rpc.LibraryListRequest) (*rpc.Library
48
48
49
49
nameFilter := strings .ToLower (req .GetName ())
50
50
51
- installedLibs := []* rpc.InstalledLibrary {}
52
- res := listLibraries (lm , req .GetUpdatable (), req .GetAll ())
51
+ allLibs := listLibraries (lm , req .GetUpdatable (), req .GetAll ())
53
52
if f := req .GetFqbn (); f != "" {
54
53
fqbn , err := cores .ParseFQBN (req .GetFqbn ())
55
54
if err != nil {
@@ -61,15 +60,16 @@ func LibraryList(ctx context.Context, req *rpc.LibraryListRequest) (*rpc.Library
61
60
}
62
61
63
62
filteredRes := map [string ]* installedLib {}
64
- for _ , lib := range res {
63
+ for _ , lib := range allLibs {
65
64
if cp := lib .Library .ContainerPlatform ; cp != nil {
66
65
if cp != boardPlatform && cp != refBoardPlatform {
67
66
// Filter all libraries from extraneous platforms
68
67
continue
69
68
}
70
69
}
71
- if latest , has := filteredRes [lib .Library .CanonicalName ]; has {
70
+ if latest , has := filteredRes [lib .Library .Name ]; has {
72
71
if latest .Library .LocationPriorityFor (boardPlatform , refBoardPlatform ) >= lib .Library .LocationPriorityFor (boardPlatform , refBoardPlatform ) {
72
+ // Pick library with the best priority
73
73
continue
74
74
}
75
75
}
@@ -86,17 +86,18 @@ func LibraryList(ctx context.Context, req *rpc.LibraryListRequest) (*rpc.Library
86
86
f : compatible ,
87
87
}
88
88
89
- filteredRes [lib .Library .CanonicalName ] = lib
89
+ filteredRes [lib .Library .Name ] = lib
90
90
}
91
91
92
- res = []* installedLib {}
92
+ allLibs = []* installedLib {}
93
93
for _ , lib := range filteredRes {
94
- res = append (res , lib )
94
+ allLibs = append (allLibs , lib )
95
95
}
96
96
}
97
97
98
- for _ , lib := range res {
99
- if nameFilter != "" && strings .ToLower (lib .Library .CanonicalName ) != nameFilter {
98
+ installedLibs := []* rpc.InstalledLibrary {}
99
+ for _ , lib := range allLibs {
100
+ if nameFilter != "" && strings .ToLower (lib .Library .Name ) != nameFilter {
100
101
continue
101
102
}
102
103
var release * rpc.LibraryRelease
@@ -105,7 +106,7 @@ func LibraryList(ctx context.Context, req *rpc.LibraryListRequest) (*rpc.Library
105
106
}
106
107
rpcLib , err := lib .Library .ToRPCLibrary ()
107
108
if err != nil {
108
- return nil , & arduino.PermissionDeniedError {Message : tr ("Error getting information for library %s" , lib .Library .CanonicalName ), Cause : err }
109
+ return nil , & arduino.PermissionDeniedError {Message : tr ("Error getting information for library %s" , lib .Library .Name ), Cause : err }
109
110
}
110
111
installedLibs = append (installedLibs , & rpc.InstalledLibrary {
111
112
Library : rpcLib ,
0 commit comments