1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-26 20:54:22 +01:00

Only rescan libraries folders when really needed

Scanning libraries is an heavy task if the sketchbook becomes huge;
This patch targets two points:

- remove the rescan() after setLibrariesFolders(), which already performs a rescan
- call setLibrariesFolders() only when the folder list has changed
  - This ensures that no scan is performed when changing board in the same architecture

Could mitigate #6350
This commit is contained in:
Martino Facchin 2017-06-23 16:50:10 +02:00
parent 1fd794dfdb
commit 73f40ac32e
2 changed files with 7 additions and 2 deletions

View File

@ -106,6 +106,10 @@ public class LibrariesIndexer {
rescanLibraries();
}
public List<File> getLibrariesFolders() {
return librariesFolders;
}
public void rescanLibraries() {
// Clear all installed flags
installedLibraries.clear();

View File

@ -679,8 +679,9 @@ public class BaseNoGui {
// Libraries located in the latest folders on the list can override
// other libraries with the same name.
librariesIndexer.setSketchbookLibrariesFolder(getSketchbookLibrariesFolder());
librariesIndexer.setLibrariesFolders(librariesFolders);
librariesIndexer.rescanLibraries();
if (librariesIndexer.getLibrariesFolders() == null || !librariesIndexer.getLibrariesFolders().equals(librariesFolders)) {
librariesIndexer.setLibrariesFolders(librariesFolders);
}
populateImportToLibraryTable();
}