Skip to content

Commit 36b35e8

Browse files
author
jan
committed
add getLibraryVersionFromFQN
1 parent d492470 commit 36b35e8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

io.sloeber.core/src/io/sloeber/arduinoFramework/api/LibraryManager.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,30 @@ public static IArduinoLibraryVersion getLibraryVersionFromLocation(IFolder libFo
475475
return getLibrariesPrivate().get(libFolder.getName());
476476
}
477477

478+
public static IArduinoLibraryVersion getLibraryVersionFromFQN(String FQNLibName, BoardDescription boardDescriptor) {
479+
String[] fqnParts = FQNLibName.split(SLACH);
480+
if (fqnParts.length < 3) {
481+
return null;
482+
}
483+
if (!SLOEBER_LIBRARY_FQN.equals(fqnParts[0])) {
484+
// this is not a library
485+
return null;
486+
}
487+
if (MANAGED.equals(fqnParts[1])) {
488+
if (BOARD.equals(fqnParts[2])) {
489+
if (boardDescriptor == null) {
490+
return null;
491+
}
492+
return getLibrariesHarware(boardDescriptor).get(FQNLibName);
493+
}
494+
return getLibrariesdManaged().get(FQNLibName);
495+
}
496+
if (PRIVATE.equals(fqnParts[1])) {
497+
return getLibrariesPrivate().get(FQNLibName);
498+
}
499+
return null;
500+
}
501+
478502
/**
479503
* Remove a lib based on the name of the lib
480504
*

0 commit comments

Comments
 (0)