mirror of https://github.com/noisymime/Arduino.git
Check sanitaryName only on basename without extension
This regression originates from:8725bb1e
Clean up sketch loading before this commit the sketch name sanitization was made on the sketch name without the extension. After8725bb1e
instead the name sanitization is made on the filename, so including the ".ino" extension. This lead to a weird corner case, caused by the limit of 63 characters on the sketch name: before8725bb1e
it would be possible to save a sketch with a name of exactly 63 characters, but after8725bb1e
this sketch will suddenly becomes invalid becuase the 63 chars name + extension would exceed the 63 characters limit. This commit fix this regression. Fix #5431
This commit is contained in:
parent
bc5c9b8b7e
commit
653a05273d
|
@ -106,7 +106,7 @@ public class Sketch {
|
||||||
private List<SketchFile> listSketchFiles(boolean showWarnings) throws IOException {
|
private List<SketchFile> listSketchFiles(boolean showWarnings) throws IOException {
|
||||||
Set<SketchFile> result = new TreeSet<>(CODE_DOCS_COMPARATOR);
|
Set<SketchFile> 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(FileUtils.splitFilename(file).basename)) {
|
||||||
result.add(new SketchFile(this, file));
|
result.add(new SketchFile(this, file));
|
||||||
} else if (showWarnings) {
|
} 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…
Reference in New Issue