mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-15 12:29:26 +01:00
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.
This commit is contained in:
parent
8725bb1ec4
commit
f7fdd08695
@ -74,7 +74,7 @@ public class SketchData {
|
|||||||
folder = new File(file.getParent());
|
folder = new File(file.getParent());
|
||||||
codeFolder = new File(folder, "code");
|
codeFolder = new File(folder, "code");
|
||||||
dataFolder = new File(folder, "data");
|
dataFolder = new File(folder, "data");
|
||||||
codes = listSketchFiles();
|
codes = listSketchFiles(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static public File checkSketchFile(File file) {
|
static public File checkSketchFile(File file) {
|
||||||
@ -109,7 +109,7 @@ public class SketchData {
|
|||||||
* not.
|
* not.
|
||||||
*/
|
*/
|
||||||
public boolean reload() throws IOException {
|
public boolean reload() throws IOException {
|
||||||
List<SketchCode> reloaded = listSketchFiles();
|
List<SketchCode> reloaded = listSketchFiles(false);
|
||||||
if (!reloaded.equals(codes)) {
|
if (!reloaded.equals(codes)) {
|
||||||
codes = reloaded;
|
codes = reloaded;
|
||||||
return true;
|
return true;
|
||||||
@ -122,13 +122,16 @@ public class SketchData {
|
|||||||
* part of this sketch. Doesn't modify this SketchData instance, just
|
* part of this sketch. Doesn't modify this SketchData instance, just
|
||||||
* returns a filtered and sorted list of File objects ready to be
|
* returns a filtered and sorted list of File objects ready to be
|
||||||
* passed to the SketchCode constructor.
|
* passed to the SketchCode constructor.
|
||||||
|
*
|
||||||
|
* @param showWarnings
|
||||||
|
* When true, any invalid filenames will show a warning.
|
||||||
*/
|
*/
|
||||||
private List<SketchCode> listSketchFiles() throws IOException {
|
private List<SketchCode> listSketchFiles(boolean showWarnings) throws IOException {
|
||||||
Set<SketchCode> result = new TreeSet<>(CODE_DOCS_COMPARATOR);
|
Set<SketchCode> result = new TreeSet<>(CODE_DOCS_COMPARATOR);
|
||||||
for (File file : FileUtils.listFiles(folder, false, EXTENSIONS)) {
|
for (File file : FileUtils.listFiles(folder, false, EXTENSIONS)) {
|
||||||
if (BaseNoGui.isSanitaryName(file.getName())) {
|
if (BaseNoGui.isSanitaryName(file.getName())) {
|
||||||
result.add(new SketchCode(file, file.equals(primaryFile)));
|
result.add(new SketchCode(file, file.equals(primaryFile)));
|
||||||
} else {
|
} else if (showWarnings) {
|
||||||
System.err.println(I18n.format(tr("File name {0} is invalid: ignored"), file.getName()));
|
System.err.println(I18n.format(tr("File name {0} is invalid: ignored"), file.getName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user