mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-14 11:29:26 +01:00
Merge pull request #2947 from Lauszus/MultipleLibraries
Allow library manager to install multiple libraries at once.
This commit is contained in:
commit
7032fcf037
@ -368,28 +368,30 @@ public class Base {
|
|||||||
indexer.setLibrariesFolders(BaseNoGui.getLibrariesPath());
|
indexer.setLibrariesFolders(BaseNoGui.getLibrariesPath());
|
||||||
installer.updateIndex();
|
installer.updateIndex();
|
||||||
|
|
||||||
String[] libraryToInstallParts = parser.getLibraryToInstall().split(":");
|
for (String library : parser.getLibraryToInstall().split(",")) {
|
||||||
|
String[] libraryToInstallParts = library.split(":");
|
||||||
|
|
||||||
ContributedLibrary selected=null;
|
ContributedLibrary selected=null;
|
||||||
if (libraryToInstallParts.length == 2) {
|
if (libraryToInstallParts.length == 2) {
|
||||||
selected = indexer.getIndex().find(libraryToInstallParts[0], VersionHelper.valueOf(libraryToInstallParts[1]).toString());
|
selected = indexer.getIndex().find(libraryToInstallParts[0], VersionHelper.valueOf(libraryToInstallParts[1]).toString());
|
||||||
} else if (libraryToInstallParts.length == 1) {
|
} else if (libraryToInstallParts.length == 1) {
|
||||||
List<ContributedLibrary> librariesByName = indexer.getIndex().find(libraryToInstallParts[0]);
|
List<ContributedLibrary> librariesByName = indexer.getIndex().find(libraryToInstallParts[0]);
|
||||||
Collections.sort(librariesByName, new DownloadableContributionVersionComparator());
|
Collections.sort(librariesByName, new DownloadableContributionVersionComparator());
|
||||||
if (!librariesByName.isEmpty()) {
|
if (!librariesByName.isEmpty()) {
|
||||||
selected = librariesByName.get(librariesByName.size() - 1);
|
selected = librariesByName.get(librariesByName.size() - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selected == null) {
|
||||||
|
System.out.println(_("Selected library is not available"));
|
||||||
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (selected == null) {
|
|
||||||
System.out.println(_("Selected library is not available"));
|
|
||||||
System.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ContributedLibrary installed = indexer.getIndex().getInstalled(libraryToInstallParts[0]);
|
ContributedLibrary installed = indexer.getIndex().getInstalled(libraryToInstallParts[0]);
|
||||||
if (selected.isReadOnly()) {
|
if (selected.isReadOnly()) {
|
||||||
installer.remove(installed);
|
installer.remove(installed);
|
||||||
} else {
|
} else {
|
||||||
installer.install(selected, installed);
|
installer.install(selected, installed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user