Skip to content

Only rescan libraries folders when really needed #6419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,14 @@ private void parseIndex(File file) throws IOException {
}

public void setLibrariesFolders(List<File> _librariesFolders) {
librariesFolders = _librariesFolders;
rescanLibraries();
if (librariesFolders != _librariesFolders && !librariesFolders.equals(_librariesFolders)) {
librariesFolders = _librariesFolders;
rescanLibraries();
}
}

public List<File> getLibrariesFolders() {
return librariesFolders;
}

public void rescanLibraries() {
Expand Down
5 changes: 2 additions & 3 deletions arduino-core/src/processing/app/BaseNoGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class BaseNoGui {
public static Map<String, LibraryList> importToLibraryTable;

// XXX: Remove this field
static private List<File> librariesFolders;
static private ArrayList<File> librariesFolders;

static UserNotifier notifier = new BasicUserNotifier();

Expand Down Expand Up @@ -245,7 +245,7 @@ static public String getHardwarePath() {
return getHardwareFolder().getAbsolutePath();
}

static public List<File> getLibrariesPath() {
static public ArrayList<File> getLibrariesPath() {
return librariesFolders;
}

Expand Down Expand Up @@ -680,7 +680,6 @@ static public void onBoardOrPortChange() {
// other libraries with the same name.
librariesIndexer.setSketchbookLibrariesFolder(getSketchbookLibrariesFolder());
librariesIndexer.setLibrariesFolders(librariesFolders);
librariesIndexer.rescanLibraries();

populateImportToLibraryTable();
}
Expand Down