11package processing .app ;
22
3+ import com .google .common .collect .FluentIterable ;
4+
35import static processing .app .I18n ._ ;
46
57import java .io .File ;
68import java .io .IOException ;
7- import java .util .ArrayList ;
8- import java .util .Arrays ;
9- import java .util .Collections ;
10- import java .util .Comparator ;
11- import java .util .List ;
9+ import java .util .*;
1210
1311public class SketchData {
1412
13+ public static final List <String > SKETCH_EXTENSIONS = Arrays .asList ("ino" , "pde" );
14+ public static final List <String > OTHER_ALLOWED_EXTENSIONS = Arrays .asList ("c" , "cpp" , "h" , "s" );
15+ public static final List <String > EXTENSIONS = new LinkedList <String >(FluentIterable .from (SKETCH_EXTENSIONS ).append (OTHER_ALLOWED_EXTENSIONS ).toList ());
16+
1517 /** main pde file for this sketch. */
1618 private File primaryFile ;
1719
@@ -105,8 +107,6 @@ protected void load() throws IOException {
105107 clearCodeDocs ();
106108// data.setCodeDocs(codeDocs);
107109
108- List <String > extensions = getExtensions ();
109-
110110 for (String filename : list ) {
111111 // Ignoring the dot prefix files is especially important to avoid files
112112 // with the ._ prefix on Mac OS X. (You'll see this with Mac files on
@@ -119,7 +119,7 @@ protected void load() throws IOException {
119119 // figure out the name without any extension
120120 String base = filename ;
121121 // now strip off the .pde and .java extensions
122- for (String extension : extensions ) {
122+ for (String extension : EXTENSIONS ) {
123123 if (base .toLowerCase ().endsWith ("." + extension )) {
124124 base = base .substring (0 , base .length () - (extension .length () + 1 ));
125125
@@ -173,13 +173,6 @@ public String getDefaultExtension() {
173173 return "ino" ;
174174 }
175175
176- /**
177- * Returns a String[] array of proper extensions.
178- */
179- public List <String > getExtensions () {
180- return Arrays .asList ("ino" , "pde" , "c" , "cpp" , "h" );
181- }
182-
183176 /**
184177 * Returns a file object for the primary .pde of this sketch.
185178 */
0 commit comments