Skip to content

Commit 73f40ac

Browse files
committed
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
1 parent 1fd794d commit 73f40ac

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

arduino-core/src/cc/arduino/contributions/libraries/LibrariesIndexer.java

+4
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ public void setLibrariesFolders(List<File> _librariesFolders) {
106106
rescanLibraries();
107107
}
108108

109+
public List<File> getLibrariesFolders() {
110+
return librariesFolders;
111+
}
112+
109113
public void rescanLibraries() {
110114
// Clear all installed flags
111115
installedLibraries.clear();

arduino-core/src/processing/app/BaseNoGui.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,9 @@ static public void onBoardOrPortChange() {
679679
// Libraries located in the latest folders on the list can override
680680
// other libraries with the same name.
681681
librariesIndexer.setSketchbookLibrariesFolder(getSketchbookLibrariesFolder());
682-
librariesIndexer.setLibrariesFolders(librariesFolders);
683-
librariesIndexer.rescanLibraries();
682+
if (librariesIndexer.getLibrariesFolders() == null || !librariesIndexer.getLibrariesFolders().equals(librariesFolders)) {
683+
librariesIndexer.setLibrariesFolders(librariesFolders);
684+
}
684685

685686
populateImportToLibraryTable();
686687
}

0 commit comments

Comments
 (0)