mirror of https://github.com/noisymime/Arduino.git
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.
This commit is contained in:
parent
281fc68304
commit
b2f8b9b6c1
|
@ -51,6 +51,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
|
@ -64,6 +65,8 @@ public class LibrariesIndexer {
|
||||||
private final File indexFile;
|
private final File indexFile;
|
||||||
private final File stagingFolder;
|
private final File stagingFolder;
|
||||||
private File sketchbookLibrariesFolder;
|
private File sketchbookLibrariesFolder;
|
||||||
|
|
||||||
|
private static final List<String> badLibNotified = new ArrayList<String>();
|
||||||
|
|
||||||
public LibrariesIndexer(File preferencesFolder, ContributionsIndexer contributionsIndexer) {
|
public LibrariesIndexer(File preferencesFolder, ContributionsIndexer contributionsIndexer) {
|
||||||
this.contributionsIndexer = contributionsIndexer;
|
this.contributionsIndexer = contributionsIndexer;
|
||||||
|
@ -135,11 +138,18 @@ public class LibrariesIndexer {
|
||||||
|
|
||||||
for (File subfolder : list) {
|
for (File subfolder : list) {
|
||||||
if (!BaseNoGui.isSanitaryName(subfolder.getName())) {
|
if (!BaseNoGui.isSanitaryName(subfolder.getName())) {
|
||||||
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
|
|
||||||
|
// Detect whether the current folder name has already had a notification.
|
||||||
|
if(!badLibNotified.contains(subfolder.getName())) {
|
||||||
|
|
||||||
|
badLibNotified.add(subfolder.getName());
|
||||||
|
|
||||||
|
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
|
||||||
+ "Library names must contain only basic letters and numbers.\n"
|
+ "Library names must contain only basic letters and numbers.\n"
|
||||||
+ "(ASCII only and no spaces, and it cannot start with a number)"),
|
+ "(ASCII only and no spaces, and it cannot start with a number)"),
|
||||||
subfolder.getName());
|
subfolder.getName());
|
||||||
BaseNoGui.showMessage(_("Ignoring bad library name"), mess);
|
BaseNoGui.showMessage(_("Ignoring bad library name"), mess);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue