Skip to content

Commit e3f39a2

Browse files
Do not show invalid sketch filename warnings on reload
With this commit, any warnings about invalid sketch filenames are not shown when the sketch is reloaded. This reloading happens whenever the IDE window is focused, so re-logging warnings all the time isn't really helpful, so this hides them.
1 parent e51ea86 commit e3f39a2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public int compare(SketchCode x, SketchCode y) {
6969
folder = new File(file.getParent());
7070
codeFolder = new File(folder, "code");
7171
dataFolder = new File(folder, "data");
72-
codes = listSketchFiles();
72+
codes = listSketchFiles(true);
7373
}
7474

7575
static public File checkSketchFile(File file) {
@@ -104,7 +104,7 @@ static public File checkSketchFile(File file) {
104104
* not.
105105
*/
106106
public boolean reload() throws IOException {
107-
List<SketchCode> reloaded = listSketchFiles();
107+
List<SketchCode> reloaded = listSketchFiles(false);
108108
if (!reloaded.equals(codes)) {
109109
codes = reloaded;
110110
return true;
@@ -121,7 +121,7 @@ public boolean reload() throws IOException {
121121
* @param showWarnings
122122
* When true, any invalid filenames will show a warning.
123123
*/
124-
private List<SketchCode> listSketchFiles() throws IOException {
124+
private List<SketchCode> listSketchFiles(boolean showWarnings) throws IOException {
125125
// get list of files in the sketch folder
126126
String filenames[] = folder.list();
127127
if (filenames == null) {
@@ -147,7 +147,7 @@ private List<SketchCode> listSketchFiles() throws IOException {
147147
// filenames. [0116]
148148
if (BaseNoGui.isSanitaryName(pieces[0])) {
149149
result.add(new SketchCode(file, file.equals(primaryFile)));
150-
} else {
150+
} else if (showWarnings) {
151151
System.err.println(I18n.format("File name {0} is invalid: ignored", filename));
152152
}
153153
}

0 commit comments

Comments
 (0)