mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
parent
2afdb8a6c3
commit
56e0349287
@ -836,7 +836,7 @@ public class Sketch {
|
||||
destFile = new File(data.getCodeFolder(), filename);
|
||||
|
||||
} else {
|
||||
for (String extension : data.getExtensions()) {
|
||||
for (String extension : SketchData.EXTENSIONS) {
|
||||
String lower = filename.toLowerCase();
|
||||
if (lower.endsWith("." + extension)) {
|
||||
destFile = new File(data.getFolder(), filename);
|
||||
@ -1345,7 +1345,7 @@ public class Sketch {
|
||||
* extensions.
|
||||
*/
|
||||
public boolean validExtension(String what) {
|
||||
return data.getExtensions().contains(what);
|
||||
return SketchData.EXTENSIONS.contains(what);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,17 +1,19 @@
|
||||
package processing.app;
|
||||
|
||||
import com.google.common.collect.FluentIterable;
|
||||
|
||||
import static processing.app.I18n._;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
public class SketchData {
|
||||
|
||||
public static final List<String> SKETCH_EXTENSIONS = Arrays.asList("ino", "pde");
|
||||
public static final List<String> OTHER_ALLOWED_EXTENSIONS = Arrays.asList("c", "cpp", "h", "s");
|
||||
public static final List<String> EXTENSIONS = new LinkedList<String>(FluentIterable.from(SKETCH_EXTENSIONS).append(OTHER_ALLOWED_EXTENSIONS).toList());
|
||||
|
||||
/** main pde file for this sketch. */
|
||||
private File primaryFile;
|
||||
|
||||
@ -105,8 +107,6 @@ public class SketchData {
|
||||
clearCodeDocs();
|
||||
// data.setCodeDocs(codeDocs);
|
||||
|
||||
List<String> extensions = getExtensions();
|
||||
|
||||
for (String filename : list) {
|
||||
// Ignoring the dot prefix files is especially important to avoid files
|
||||
// with the ._ prefix on Mac OS X. (You'll see this with Mac files on
|
||||
@ -119,7 +119,7 @@ public class SketchData {
|
||||
// figure out the name without any extension
|
||||
String base = filename;
|
||||
// now strip off the .pde and .java extensions
|
||||
for (String extension : extensions) {
|
||||
for (String extension : EXTENSIONS) {
|
||||
if (base.toLowerCase().endsWith("." + extension)) {
|
||||
base = base.substring(0, base.length() - (extension.length() + 1));
|
||||
|
||||
@ -173,13 +173,6 @@ public class SketchData {
|
||||
return "ino";
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a String[] array of proper extensions.
|
||||
*/
|
||||
public List<String> getExtensions() {
|
||||
return Arrays.asList("ino", "pde", "c", "cpp", "h");
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a file object for the primary .pde of this sketch.
|
||||
*/
|
||||
|
@ -1201,7 +1201,7 @@ public class Compiler implements MessageConsumer {
|
||||
StringBuffer bigCode = new StringBuffer();
|
||||
int bigCount = 0;
|
||||
for (SketchCode sc : sketch.getCodes()) {
|
||||
if (sc.isExtension("ino") || sc.isExtension("pde")) {
|
||||
if (sc.isExtension(SketchData.SKETCH_EXTENSIONS)) {
|
||||
sc.setPreprocOffset(bigCount);
|
||||
// These #line directives help the compiler report errors with
|
||||
// correct the filename and line number (issue 281 & 907)
|
||||
@ -1272,7 +1272,7 @@ public class Compiler implements MessageConsumer {
|
||||
// 3. then loop over the code[] and save each .java file
|
||||
|
||||
for (SketchCode sc : sketch.getCodes()) {
|
||||
if (sc.isExtension("c") || sc.isExtension("cpp") || sc.isExtension("h")) {
|
||||
if (sc.isExtension(SketchData.OTHER_ALLOWED_EXTENSIONS)) {
|
||||
// no pre-processing services necessary for java files
|
||||
// just write the the contents of 'program' to a .java file
|
||||
// into the build directory. uses byte stream and reader/writer
|
||||
|
Loading…
Reference in New Issue
Block a user