1
1
package processing .app ;
2
2
3
+ import com .google .common .collect .FluentIterable ;
4
+
3
5
import static processing .app .I18n ._ ;
4
6
5
7
import java .io .File ;
6
8
import 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 .*;
12
10
13
11
public class SketchData {
14
12
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
+
15
17
/** main pde file for this sketch. */
16
18
private File primaryFile ;
17
19
@@ -105,8 +107,6 @@ protected void load() throws IOException {
105
107
clearCodeDocs ();
106
108
// data.setCodeDocs(codeDocs);
107
109
108
- List <String > extensions = getExtensions ();
109
-
110
110
for (String filename : list ) {
111
111
// Ignoring the dot prefix files is especially important to avoid files
112
112
// with the ._ prefix on Mac OS X. (You'll see this with Mac files on
@@ -119,7 +119,7 @@ protected void load() throws IOException {
119
119
// figure out the name without any extension
120
120
String base = filename ;
121
121
// now strip off the .pde and .java extensions
122
- for (String extension : extensions ) {
122
+ for (String extension : EXTENSIONS ) {
123
123
if (base .toLowerCase ().endsWith ("." + extension )) {
124
124
base = base .substring (0 , base .length () - (extension .length () + 1 ));
125
125
@@ -173,13 +173,6 @@ public String getDefaultExtension() {
173
173
return "ino" ;
174
174
}
175
175
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
-
183
176
/**
184
177
* Returns a file object for the primary .pde of this sketch.
185
178
*/
0 commit comments