Skip to content

Commit 5c12c8f

Browse files
author
Luca Bianconi
committed
fix: scan libraries before install
1 parent 271d241 commit 5c12c8f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

arduino/libraries/librariesmanager/install.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ func (lm *LibrariesManager) InstallPrerequisiteCheck(name string, version *semve
6464
return nil, err
6565
}
6666

67+
lm.RescanLibraries()
6768
libs := lm.FindByReference(&librariesindex.Reference{Name: name}, installLocation)
6869

6970
if len(libs) > 1 {

arduino/libraries/librariesmanager/librariesmanager.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,15 @@ func (lm *LibrariesManager) AddPlatformReleaseLibrariesDir(plaftormRelease *core
130130
})
131131
}
132132

133+
func (lm *LibrariesManager) ClearLibraries() {
134+
for k := range lm.Libraries {
135+
delete(lm.Libraries, k)
136+
}
137+
}
138+
133139
// RescanLibraries reload all installed libraries in the system.
134140
func (lm *LibrariesManager) RescanLibraries() []*status.Status {
141+
lm.ClearLibraries()
135142
statuses := []*status.Status{}
136143
for _, dir := range lm.LibrariesDir {
137144
if errs := lm.LoadLibrariesFromDir(dir); len(errs) > 0 {

0 commit comments

Comments
 (0)