Skip to content

Commit 72981b3

Browse files
committed
IDE: prevent multiple bad name notifications.
This patch will prevent the IDE from informing the user about a bad sketch folder name multiple times. Now the user is informed once at start up only, or once when it is detected during a rescan of the folders.
1 parent fe94d6a commit 72981b3

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ public class LibrariesIndexer {
5757
private final File indexFile;
5858
private final File stagingFolder;
5959
private File sketchbookLibrariesFolder;
60+
61+
private static List<String> badLibNotified;
6062

6163
public LibrariesIndexer(File preferencesFolder) {
6264
indexFile = new File(preferencesFolder, "library_index.json");
@@ -117,11 +119,18 @@ private void scanInstalledLibraries(File folder, boolean isSketchbook) {
117119

118120
for (File subfolder : list) {
119121
if (!BaseNoGui.isSanitaryName(subfolder.getName())) {
120-
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
122+
123+
// Detect whether the current folder name has already had a notification.
124+
if(!badLibNotified.contains(subfolder.getName())) {
125+
126+
badLibNotified.add(subfolder.getName());
127+
128+
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
121129
+ "Library names must contain only basic letters and numbers.\n"
122130
+ "(ASCII only and no spaces, and it cannot start with a number)"),
123131
subfolder.getName());
124-
BaseNoGui.showMessage(_("Ignoring bad library name"), mess);
132+
BaseNoGui.showMessage(_("Ignoring bad library name"), mess);
133+
}
125134
continue;
126135
}
127136

0 commit comments

Comments
 (0)