mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +01:00
Merge remote-tracking branch 'origin/ide-1.5.x' into ide-1.5.x
This commit is contained in:
commit
034cb91737
@ -32,7 +32,6 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileNameExtensionFilter;
|
||||
|
||||
import org.apache.commons.logging.impl.LogFactoryImpl;
|
||||
import org.apache.commons.logging.impl.NoOpLog;
|
||||
@ -46,6 +45,7 @@ import processing.app.helpers.FileUtils;
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
import processing.app.helpers.filefilters.OnlyDirs;
|
||||
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
||||
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
|
||||
import processing.app.packages.Library;
|
||||
import processing.app.packages.LibraryList;
|
||||
import processing.app.tools.ZipDeflater;
|
||||
@ -1523,35 +1523,39 @@ public class Base {
|
||||
* should replace the sketch in the current window, or false when the
|
||||
* sketch should open in a new window.
|
||||
*/
|
||||
protected boolean addSketches(JMenu menu, File folder,
|
||||
final boolean replaceExisting) throws IOException {
|
||||
protected boolean addSketches(JMenu menu, File folder, final boolean replaceExisting) throws IOException {
|
||||
if (folder == null)
|
||||
return false;
|
||||
|
||||
// skip .DS_Store files, etc (this shouldn't actually be necessary)
|
||||
if (!folder.isDirectory()) return false;
|
||||
|
||||
String[] list = folder.list();
|
||||
File[] files = folder.listFiles();
|
||||
// If a bad folder or unreadable or whatever, this will come back null
|
||||
if (list == null) return false;
|
||||
if (files == null) return false;
|
||||
|
||||
// Alphabetize list, since it's not always alpha order
|
||||
Arrays.sort(list, String.CASE_INSENSITIVE_ORDER);
|
||||
// Alphabetize files, since it's not always alpha order
|
||||
Arrays.sort(files, new Comparator<File>() {
|
||||
@Override
|
||||
public int compare(File file, File file2) {
|
||||
return file.getName().compareToIgnoreCase(file2.getName());
|
||||
}
|
||||
});
|
||||
|
||||
boolean ifound = false;
|
||||
|
||||
for (String name : list) {
|
||||
if ((name.charAt(0) == '.') ||
|
||||
name.equals("CVS")) continue;
|
||||
for (File subfolder : files) {
|
||||
if (FileUtils.isSCCSOrHiddenFile(subfolder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
File subfolder = new File(folder, name);
|
||||
if (!subfolder.isDirectory()) continue;
|
||||
|
||||
if (addSketchesSubmenu(menu, name, subfolder, replaceExisting))
|
||||
if (addSketchesSubmenu(menu, subfolder.getName(), subfolder, replaceExisting)) {
|
||||
ifound = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ifound; // actually ignored, but..
|
||||
return ifound;
|
||||
}
|
||||
|
||||
private boolean addSketchesSubmenu(JMenu menu, Library lib,
|
||||
|
@ -38,6 +38,7 @@ import processing.app.I18n;
|
||||
import processing.app.Preferences;
|
||||
import processing.app.Sketch;
|
||||
import processing.app.SketchCode;
|
||||
import processing.app.helpers.FileUtils;
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
import processing.app.helpers.ProcessUtils;
|
||||
import processing.app.helpers.StringReplacer;
|
||||
@ -235,7 +236,7 @@ public class Compiler implements MessageConsumer {
|
||||
File objectFile = new File(objectPath);
|
||||
File dependFile = new File(dependPath);
|
||||
objectPaths.add(objectFile);
|
||||
if (is_already_compiled(file, objectFile, dependFile, prefs))
|
||||
if (isAlreadyCompiled(file, objectFile, dependFile, prefs))
|
||||
continue;
|
||||
String[] cmd = getCommandCompilerC(includePaths, file.getAbsolutePath(),
|
||||
objectPath);
|
||||
@ -248,7 +249,7 @@ public class Compiler implements MessageConsumer {
|
||||
File objectFile = new File(objectPath);
|
||||
File dependFile = new File(dependPath);
|
||||
objectPaths.add(objectFile);
|
||||
if (is_already_compiled(file, objectFile, dependFile, prefs))
|
||||
if (isAlreadyCompiled(file, objectFile, dependFile, prefs))
|
||||
continue;
|
||||
String[] cmd = getCommandCompilerCPP(includePaths,
|
||||
file.getAbsolutePath(), objectPath);
|
||||
@ -258,10 +259,10 @@ public class Compiler implements MessageConsumer {
|
||||
return objectPaths;
|
||||
}
|
||||
|
||||
private boolean is_already_compiled(File src, File obj, File dep, Map<String, String> prefs) {
|
||||
private boolean isAlreadyCompiled(File src, File obj, File dep, Map<String, String> prefs) {
|
||||
boolean ret=true;
|
||||
try {
|
||||
//System.out.println("\n is_already_compiled: begin checks: " + obj.getPath());
|
||||
//System.out.println("\n isAlreadyCompiled: begin checks: " + obj.getPath());
|
||||
if (!obj.exists()) return false; // object file (.o) does not exist
|
||||
if (!dep.exists()) return false; // dep file (.d) does not exist
|
||||
long src_modified = src.lastModified();
|
||||
@ -284,8 +285,8 @@ public class Compiler implements MessageConsumer {
|
||||
String objpath = obj.getCanonicalPath();
|
||||
File linefile = new File(line);
|
||||
String linepath = linefile.getCanonicalPath();
|
||||
//System.out.println(" is_already_compiled: obj = " + objpath);
|
||||
//System.out.println(" is_already_compiled: line = " + linepath);
|
||||
//System.out.println(" isAlreadyCompiled: obj = " + objpath);
|
||||
//System.out.println(" isAlreadyCompiled: line = " + linepath);
|
||||
if (objpath.compareTo(linepath) == 0) {
|
||||
need_obj_parse = false;
|
||||
continue;
|
||||
@ -308,7 +309,7 @@ public class Compiler implements MessageConsumer {
|
||||
ret = false; // prerequisite modified since object was compiled
|
||||
break;
|
||||
}
|
||||
//System.out.println(" is_already_compiled: prerequisite ok");
|
||||
//System.out.println(" isAlreadyCompiled: prerequisite ok");
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
@ -575,12 +576,19 @@ public class Compiler implements MessageConsumer {
|
||||
boolean recurse) {
|
||||
List<File> files = new ArrayList<File>();
|
||||
|
||||
if (folder.listFiles() == null)
|
||||
if (FileUtils.isSCCSOrHiddenFile(folder)) {
|
||||
return files;
|
||||
}
|
||||
|
||||
for (File file : folder.listFiles()) {
|
||||
if (file.getName().startsWith("."))
|
||||
File[] listFiles = folder.listFiles();
|
||||
if (listFiles == null) {
|
||||
return files;
|
||||
}
|
||||
|
||||
for (File file : listFiles) {
|
||||
if (FileUtils.isSCCSOrHiddenFile(file)) {
|
||||
continue; // skip hidden files
|
||||
}
|
||||
|
||||
if (file.getName().endsWith("." + extension))
|
||||
files.add(file);
|
||||
|
@ -4,11 +4,14 @@ import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class FileUtils {
|
||||
|
||||
private static final List<String> SOURCE_CONTROL_FOLDERS = Arrays.asList("CVS", "RCS", ".git", ".svn", ".hg", ".bzr");
|
||||
private static final Pattern BACKSLASH = Pattern.compile("\\\\");
|
||||
|
||||
/**
|
||||
@ -163,4 +166,8 @@ public class FileUtils {
|
||||
public static String getLinuxPathFrom(File file) {
|
||||
return BACKSLASH.matcher(file.getAbsolutePath()).replaceAll("/");
|
||||
}
|
||||
|
||||
public static boolean isSCCSOrHiddenFile(File file) {
|
||||
return file.isHidden() || file.getName().charAt(0) == '.' || (file.isDirectory() && SOURCE_CONTROL_FOLDERS.contains(file.getName()));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package processing.app.packages;
|
||||
|
||||
import processing.app.helpers.FileUtils;
|
||||
import processing.app.helpers.PreferencesMap;
|
||||
|
||||
import java.io.File;
|
||||
@ -35,6 +36,7 @@ public class Library {
|
||||
private static final List<String> OPTIONAL_FILES = Arrays
|
||||
.asList(new String[] { "keywords.txt", "library.properties" });
|
||||
|
||||
|
||||
/**
|
||||
* Scans inside a folder and create a Library object out of it. Automatically
|
||||
* detects pre-1.5 libraries. Automatically fills metadata from
|
||||
@ -75,6 +77,10 @@ public class Library {
|
||||
// 3. check if root folder contains prohibited stuff
|
||||
for (File file : libFolder.listFiles()) {
|
||||
if (file.isDirectory()) {
|
||||
if (FileUtils.isSCCSOrHiddenFile(file)) {
|
||||
System.out.println("WARNING: Ignoring spurious " + file.getName() + " folder in '" + properties.get("name") + "' library");
|
||||
continue;
|
||||
}
|
||||
if (!OPTIONAL_FOLDERS.contains(file.getName()))
|
||||
throw new IOException("Invalid folder '" + file.getName() + "'.");
|
||||
} else {
|
||||
@ -124,7 +130,7 @@ public class Library {
|
||||
res.folder = libFolder;
|
||||
res.srcFolder = libFolder;
|
||||
res.name = libFolder.getName();
|
||||
res.architectures = Arrays.asList(new String[]{"*"});
|
||||
res.architectures = Arrays.asList("*");
|
||||
res.pre15Lib = true;
|
||||
return res;
|
||||
}
|
||||
|
@ -28,5 +28,10 @@ public class SystemProfilerParserTest {
|
||||
|
||||
assertEquals("0X2341_0X0041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem04101"));
|
||||
assertEquals("0X2341_0X0041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem04101"));
|
||||
|
||||
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output5.txt"));
|
||||
|
||||
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem06201"));
|
||||
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem06201"));
|
||||
}
|
||||
}
|
||||
|
94
app/test/processing/app/macosx/system_profiler_output5.txt
Normal file
94
app/test/processing/app/macosx/system_profiler_output5.txt
Normal file
@ -0,0 +1,94 @@
|
||||
USB:
|
||||
|
||||
USB Hi-Speed Bus:
|
||||
|
||||
Host Controller Location: Built-in USB
|
||||
Host Controller Driver: AppleUSBEHCI
|
||||
PCI Device ID: 0x0d9d
|
||||
PCI Revision ID: 0x00a2
|
||||
PCI Vendor ID: 0x10de
|
||||
Bus Number: 0x24
|
||||
|
||||
FaceTime Camera (Built-in):
|
||||
|
||||
Product ID: 0x850a
|
||||
Vendor ID: 0x05ac (Apple Inc.)
|
||||
Version: 6.26
|
||||
Serial Number: CCGB1KY362DF9KL0
|
||||
Speed: Up to 480 Mb/sec
|
||||
Manufacturer: Apple Inc.
|
||||
Location ID: 0x24600000 / 2
|
||||
Current Available (mA): 500
|
||||
Current Required (mA): 500
|
||||
|
||||
USB Hi-Speed Bus:
|
||||
|
||||
Host Controller Location: Built-in USB
|
||||
Host Controller Driver: AppleUSBEHCI
|
||||
PCI Device ID: 0x0d9d
|
||||
PCI Revision ID: 0x00a2
|
||||
PCI Vendor ID: 0x10de
|
||||
Bus Number: 0x26
|
||||
|
||||
USB Bus:
|
||||
|
||||
Host Controller Location: Built-in USB
|
||||
Host Controller Driver: AppleUSBOHCI
|
||||
PCI Device ID: 0x0d9c
|
||||
PCI Revision ID: 0x00a1
|
||||
PCI Vendor ID: 0x10de
|
||||
Bus Number: 0x04
|
||||
|
||||
BRCM2070 Hub:
|
||||
|
||||
Product ID: 0x4500
|
||||
Vendor ID: 0x0a5c (Broadcom Corp.)
|
||||
Version: 1.00
|
||||
Speed: Up to 12 Mb/sec
|
||||
Manufacturer: Apple Inc.
|
||||
Location ID: 0x04500000 / 3
|
||||
Current Available (mA): 500
|
||||
Current Required (mA): 94
|
||||
|
||||
Bluetooth USB Host Controller:
|
||||
|
||||
Product ID: 0x821b
|
||||
Vendor ID: 0x05ac (Apple Inc.)
|
||||
Version: 0.41
|
||||
Speed: Up to 12 Mb/sec
|
||||
Manufacturer: Apple Inc.
|
||||
Location ID: 0x04530000 / 6
|
||||
Current Available (mA): 500
|
||||
Current Required (mA): 0
|
||||
|
||||
Apple Internal Keyboard / Trackpad:
|
||||
|
||||
Product ID: 0x0242
|
||||
Vendor ID: 0x05ac (Apple Inc.)
|
||||
Version: 1.07
|
||||
Speed: Up to 12 Mb/sec
|
||||
Manufacturer: Apple Inc.
|
||||
Location ID: 0x04300000 / 2
|
||||
Current Available (mA): 500
|
||||
Current Required (mA): 40
|
||||
|
||||
USB Bus:
|
||||
|
||||
Host Controller Location: Built-in USB
|
||||
Host Controller Driver: AppleUSBOHCI
|
||||
PCI Device ID: 0x0d9c
|
||||
PCI Revision ID: 0x00a1
|
||||
PCI Vendor ID: 0x10de
|
||||
Bus Number: 0x06
|
||||
|
||||
Arduino Yun:
|
||||
|
||||
Product ID: 0x8041
|
||||
Vendor ID: 0x2341
|
||||
Version: 1.00
|
||||
Speed: Up to 12 Mb/sec
|
||||
Manufacturer: Arduino LLC
|
||||
Location ID: 0x06200000 / 2
|
||||
Current Available (mA): 500
|
||||
Current Required (mA): 500
|
||||
|
@ -950,10 +950,10 @@ char getch(void)
|
||||
count++;
|
||||
if (count > MAX_TIME_COUNT)
|
||||
app_start();
|
||||
}
|
||||
|
||||
return UDR0;
|
||||
}
|
||||
|
||||
return UDR0;
|
||||
}
|
||||
else if(bootuart == 2) {
|
||||
while(!(UCSR1A & _BV(RXC1))) {
|
||||
/* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/
|
||||
|
@ -44,6 +44,7 @@ File::File(void) {
|
||||
}
|
||||
|
||||
File::~File(void) {
|
||||
close();
|
||||
// Serial.print("Deleted file object");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user