@@ -78,9 +78,9 @@ func (alts *LibraryAlternatives) Remove(library *libraries.Library) {
78
78
}
79
79
80
80
// FindVersion returns the library mathching the provided version or nil if not found
81
- func (alts * LibraryAlternatives ) FindVersion (version * semver.Version ) * libraries.Library {
81
+ func (alts * LibraryAlternatives ) FindVersion (version * semver.Version , installLocation libraries. LibraryLocation ) * libraries.Library {
82
82
for _ , lib := range alts .Alternatives {
83
- if lib .Version .Equal (version ) {
83
+ if lib .Version .Equal (version ) && lib . Location == installLocation {
84
84
return lib
85
85
}
86
86
}
@@ -245,7 +245,7 @@ func (lm *LibrariesManager) LoadLibraryFromDir(libRootDir *paths.Path, location
245
245
// FindByReference return the installed library matching the Reference
246
246
// name and version or, if the version is nil, the library installed
247
247
// in the User folder.
248
- func (lm * LibrariesManager ) FindByReference (libRef * librariesindex.Reference ) * libraries.Library {
248
+ func (lm * LibrariesManager ) FindByReference (libRef * librariesindex.Reference , installLocation libraries. LibraryLocation ) * libraries.Library {
249
249
saneName := utils .SanitizeName (libRef .Name )
250
250
alternatives , have := lm .Libraries [saneName ]
251
251
if ! have {
@@ -254,11 +254,11 @@ func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference) *l
254
254
// TODO: Move "search into user" into another method...
255
255
if libRef .Version == nil {
256
256
for _ , candidate := range alternatives .Alternatives {
257
- if candidate .Location == libraries . User {
257
+ if candidate .Location == installLocation {
258
258
return candidate
259
259
}
260
260
}
261
261
return nil
262
262
}
263
- return alternatives .FindVersion (libRef .Version )
263
+ return alternatives .FindVersion (libRef .Version , installLocation )
264
264
}
0 commit comments