File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
arduino-core/src/processing/app Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -103,9 +103,7 @@ private List<SketchFile> listSketchFiles(boolean showWarnings) throws IOExceptio
103103 Set <SketchFile > result = new TreeSet <>(CODE_DOCS_COMPARATOR );
104104 for (File file : FileUtils .listFiles (folder , false , EXTENSIONS )) {
105105 if (BaseNoGui .isSanitaryName (file .getName ())) {
106- FileUtils .SplitFile split = FileUtils .splitFilename (file );
107- boolean isPrimary = split .basename .equals (folder .getName ()) && SKETCH_EXTENSIONS .contains (split .extension );
108- result .add (new SketchFile (this , file , isPrimary ));
106+ result .add (new SketchFile (this , file ));
109107 } else if (showWarnings ) {
110108 System .err .println (I18n .format ("File name {0} is invalid: ignored" , file .getName ()));
111109 }
@@ -287,7 +285,7 @@ public SketchFile addFile(String newName) throws IOException {
287285 checkNewFilename (newFile );
288286
289287 // Add a new sketchFile
290- SketchFile sketchFile = new SketchFile (this , newFile , false );
288+ SketchFile sketchFile = new SketchFile (this , newFile );
291289 files .add (sketchFile );
292290 Collections .sort (files , CODE_DOCS_COMPARATOR );
293291
Original file line number Diff line number Diff line change @@ -91,10 +91,12 @@ public static interface TextStorage {
9191 * @param primary
9292 * Whether this file is the primary file of the sketch
9393 */
94- public SketchFile (Sketch sketch , File file , boolean primary ) {
94+ public SketchFile (Sketch sketch , File file ) {
9595 this .sketch = sketch ;
9696 this .file = file ;
97- this .primary = primary ;
97+ FileUtils .SplitFile split = FileUtils .splitFilename (file );
98+ this .primary = split .basename .equals (sketch .getFolder ().getName ())
99+ && Sketch .SKETCH_EXTENSIONS .contains (split .extension );
98100 }
99101
100102 /**
You can’t perform that action at this time.
0 commit comments