Skip to content

Commit 034cb91

Browse files
committed
Merge remote-tracking branch 'origin/ide-1.5.x' into ide-1.5.x
2 parents 02550de + 6378c8c commit 034cb91

File tree

8 files changed

+153
-28
lines changed

8 files changed

+153
-28
lines changed

app/src/processing/app/Base.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import java.util.logging.Logger;
3333

3434
import javax.swing.*;
35-
import javax.swing.filechooser.FileNameExtensionFilter;
3635

3736
import org.apache.commons.logging.impl.LogFactoryImpl;
3837
import org.apache.commons.logging.impl.NoOpLog;
@@ -46,6 +45,7 @@
4645
import processing.app.helpers.PreferencesMap;
4746
import processing.app.helpers.filefilters.OnlyDirs;
4847
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
48+
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;
4949
import processing.app.packages.Library;
5050
import processing.app.packages.LibraryList;
5151
import processing.app.tools.ZipDeflater;
@@ -1523,35 +1523,39 @@ public void actionPerformed(ActionEvent actionevent) {
15231523
* should replace the sketch in the current window, or false when the
15241524
* sketch should open in a new window.
15251525
*/
1526-
protected boolean addSketches(JMenu menu, File folder,
1527-
final boolean replaceExisting) throws IOException {
1526+
protected boolean addSketches(JMenu menu, File folder, final boolean replaceExisting) throws IOException {
15281527
if (folder == null)
15291528
return false;
15301529

1531-
// skip .DS_Store files, etc (this shouldn't actually be necessary)
15321530
if (!folder.isDirectory()) return false;
15331531

1534-
String[] list = folder.list();
1532+
File[] files = folder.listFiles();
15351533
// If a bad folder or unreadable or whatever, this will come back null
1536-
if (list == null) return false;
1534+
if (files == null) return false;
15371535

1538-
// Alphabetize list, since it's not always alpha order
1539-
Arrays.sort(list, String.CASE_INSENSITIVE_ORDER);
1536+
// Alphabetize files, since it's not always alpha order
1537+
Arrays.sort(files, new Comparator<File>() {
1538+
@Override
1539+
public int compare(File file, File file2) {
1540+
return file.getName().compareToIgnoreCase(file2.getName());
1541+
}
1542+
});
15401543

15411544
boolean ifound = false;
15421545

1543-
for (String name : list) {
1544-
if ((name.charAt(0) == '.') ||
1545-
name.equals("CVS")) continue;
1546+
for (File subfolder : files) {
1547+
if (FileUtils.isSCCSOrHiddenFile(subfolder)) {
1548+
continue;
1549+
}
15461550

1547-
File subfolder = new File(folder, name);
15481551
if (!subfolder.isDirectory()) continue;
15491552

1550-
if (addSketchesSubmenu(menu, name, subfolder, replaceExisting))
1553+
if (addSketchesSubmenu(menu, subfolder.getName(), subfolder, replaceExisting)) {
15511554
ifound = true;
1555+
}
15521556
}
15531557

1554-
return ifound; // actually ignored, but..
1558+
return ifound;
15551559
}
15561560

15571561
private boolean addSketchesSubmenu(JMenu menu, Library lib,

app/src/processing/app/debug/Compiler.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import processing.app.Preferences;
3939
import processing.app.Sketch;
4040
import processing.app.SketchCode;
41+
import processing.app.helpers.FileUtils;
4142
import processing.app.helpers.PreferencesMap;
4243
import processing.app.helpers.ProcessUtils;
4344
import processing.app.helpers.StringReplacer;
@@ -235,7 +236,7 @@ private List<File> compileFiles(String outputPath, File sourcePath,
235236
File objectFile = new File(objectPath);
236237
File dependFile = new File(dependPath);
237238
objectPaths.add(objectFile);
238-
if (is_already_compiled(file, objectFile, dependFile, prefs))
239+
if (isAlreadyCompiled(file, objectFile, dependFile, prefs))
239240
continue;
240241
String[] cmd = getCommandCompilerC(includePaths, file.getAbsolutePath(),
241242
objectPath);
@@ -248,7 +249,7 @@ private List<File> compileFiles(String outputPath, File sourcePath,
248249
File objectFile = new File(objectPath);
249250
File dependFile = new File(dependPath);
250251
objectPaths.add(objectFile);
251-
if (is_already_compiled(file, objectFile, dependFile, prefs))
252+
if (isAlreadyCompiled(file, objectFile, dependFile, prefs))
252253
continue;
253254
String[] cmd = getCommandCompilerCPP(includePaths,
254255
file.getAbsolutePath(), objectPath);
@@ -258,10 +259,10 @@ private List<File> compileFiles(String outputPath, File sourcePath,
258259
return objectPaths;
259260
}
260261

261-
private boolean is_already_compiled(File src, File obj, File dep, Map<String, String> prefs) {
262+
private boolean isAlreadyCompiled(File src, File obj, File dep, Map<String, String> prefs) {
262263
boolean ret=true;
263264
try {
264-
//System.out.println("\n is_already_compiled: begin checks: " + obj.getPath());
265+
//System.out.println("\n isAlreadyCompiled: begin checks: " + obj.getPath());
265266
if (!obj.exists()) return false; // object file (.o) does not exist
266267
if (!dep.exists()) return false; // dep file (.d) does not exist
267268
long src_modified = src.lastModified();
@@ -284,8 +285,8 @@ private boolean is_already_compiled(File src, File obj, File dep, Map<String, St
284285
String objpath = obj.getCanonicalPath();
285286
File linefile = new File(line);
286287
String linepath = linefile.getCanonicalPath();
287-
//System.out.println(" is_already_compiled: obj = " + objpath);
288-
//System.out.println(" is_already_compiled: line = " + linepath);
288+
//System.out.println(" isAlreadyCompiled: obj = " + objpath);
289+
//System.out.println(" isAlreadyCompiled: line = " + linepath);
289290
if (objpath.compareTo(linepath) == 0) {
290291
need_obj_parse = false;
291292
continue;
@@ -308,7 +309,7 @@ private boolean is_already_compiled(File src, File obj, File dep, Map<String, St
308309
ret = false; // prerequisite modified since object was compiled
309310
break;
310311
}
311-
//System.out.println(" is_already_compiled: prerequisite ok");
312+
//System.out.println(" isAlreadyCompiled: prerequisite ok");
312313
}
313314
}
314315
reader.close();
@@ -575,12 +576,19 @@ static public List<File> findFilesInFolder(File folder, String extension,
575576
boolean recurse) {
576577
List<File> files = new ArrayList<File>();
577578

578-
if (folder.listFiles() == null)
579+
if (FileUtils.isSCCSOrHiddenFile(folder)) {
579580
return files;
581+
}
580582

581-
for (File file : folder.listFiles()) {
582-
if (file.getName().startsWith("."))
583+
File[] listFiles = folder.listFiles();
584+
if (listFiles == null) {
585+
return files;
586+
}
587+
588+
for (File file : listFiles) {
589+
if (FileUtils.isSCCSOrHiddenFile(file)) {
583590
continue; // skip hidden files
591+
}
584592

585593
if (file.getName().endsWith("." + extension))
586594
files.add(file);

app/src/processing/app/helpers/FileUtils.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44
import java.io.FileInputStream;
55
import java.io.FileOutputStream;
66
import java.io.IOException;
7+
import java.util.Arrays;
8+
import java.util.List;
79
import java.util.Random;
810
import java.util.regex.Pattern;
911

1012
public class FileUtils {
1113

14+
private static final List<String> SOURCE_CONTROL_FOLDERS = Arrays.asList("CVS", "RCS", ".git", ".svn", ".hg", ".bzr");
1215
private static final Pattern BACKSLASH = Pattern.compile("\\\\");
1316

1417
/**
@@ -163,4 +166,8 @@ public static String relativePath(String origin, String target) {
163166
public static String getLinuxPathFrom(File file) {
164167
return BACKSLASH.matcher(file.getAbsolutePath()).replaceAll("/");
165168
}
169+
170+
public static boolean isSCCSOrHiddenFile(File file) {
171+
return file.isHidden() || file.getName().charAt(0) == '.' || (file.isDirectory() && SOURCE_CONTROL_FOLDERS.contains(file.getName()));
172+
}
166173
}

app/src/processing/app/packages/Library.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package processing.app.packages;
22

3+
import processing.app.helpers.FileUtils;
34
import processing.app.helpers.PreferencesMap;
45

56
import java.io.File;
@@ -35,6 +36,7 @@ public class Library {
3536
private static final List<String> OPTIONAL_FILES = Arrays
3637
.asList(new String[] { "keywords.txt", "library.properties" });
3738

39+
3840
/**
3941
* Scans inside a folder and create a Library object out of it. Automatically
4042
* detects pre-1.5 libraries. Automatically fills metadata from
@@ -75,6 +77,10 @@ private static Library createLibrary(File libFolder) throws IOException {
7577
// 3. check if root folder contains prohibited stuff
7678
for (File file : libFolder.listFiles()) {
7779
if (file.isDirectory()) {
80+
if (FileUtils.isSCCSOrHiddenFile(file)) {
81+
System.out.println("WARNING: Ignoring spurious " + file.getName() + " folder in '" + properties.get("name") + "' library");
82+
continue;
83+
}
7884
if (!OPTIONAL_FOLDERS.contains(file.getName()))
7985
throw new IOException("Invalid folder '" + file.getName() + "'.");
8086
} else {
@@ -124,7 +130,7 @@ private static Library createPre15Library(File libFolder) {
124130
res.folder = libFolder;
125131
res.srcFolder = libFolder;
126132
res.name = libFolder.getName();
127-
res.architectures = Arrays.asList(new String[]{"*"});
133+
res.architectures = Arrays.asList("*");
128134
res.pre15Lib = true;
129135
return res;
130136
}

app/test/processing/app/macosx/SystemProfilerParserTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,10 @@ public void shouldCorrectlyParse() throws Exception {
2828

2929
assertEquals("0X2341_0X0041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem04101"));
3030
assertEquals("0X2341_0X0041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem04101"));
31+
32+
output = TestHelper.inputStreamToString(SystemProfilerParserTest.class.getResourceAsStream("system_profiler_output5.txt"));
33+
34+
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/cu.usbmodem06201"));
35+
assertEquals("0X2341_0X8041", new SystemProfilerParser().extractVIDAndPID(output, "/dev/tty.usbmodem06201"));
3136
}
3237
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
USB:
2+
3+
USB Hi-Speed Bus:
4+
5+
Host Controller Location: Built-in USB
6+
Host Controller Driver: AppleUSBEHCI
7+
PCI Device ID: 0x0d9d
8+
PCI Revision ID: 0x00a2
9+
PCI Vendor ID: 0x10de
10+
Bus Number: 0x24
11+
12+
FaceTime Camera (Built-in):
13+
14+
Product ID: 0x850a
15+
Vendor ID: 0x05ac (Apple Inc.)
16+
Version: 6.26
17+
Serial Number: CCGB1KY362DF9KL0
18+
Speed: Up to 480 Mb/sec
19+
Manufacturer: Apple Inc.
20+
Location ID: 0x24600000 / 2
21+
Current Available (mA): 500
22+
Current Required (mA): 500
23+
24+
USB Hi-Speed Bus:
25+
26+
Host Controller Location: Built-in USB
27+
Host Controller Driver: AppleUSBEHCI
28+
PCI Device ID: 0x0d9d
29+
PCI Revision ID: 0x00a2
30+
PCI Vendor ID: 0x10de
31+
Bus Number: 0x26
32+
33+
USB Bus:
34+
35+
Host Controller Location: Built-in USB
36+
Host Controller Driver: AppleUSBOHCI
37+
PCI Device ID: 0x0d9c
38+
PCI Revision ID: 0x00a1
39+
PCI Vendor ID: 0x10de
40+
Bus Number: 0x04
41+
42+
BRCM2070 Hub:
43+
44+
Product ID: 0x4500
45+
Vendor ID: 0x0a5c (Broadcom Corp.)
46+
Version: 1.00
47+
Speed: Up to 12 Mb/sec
48+
Manufacturer: Apple Inc.
49+
Location ID: 0x04500000 / 3
50+
Current Available (mA): 500
51+
Current Required (mA): 94
52+
53+
Bluetooth USB Host Controller:
54+
55+
Product ID: 0x821b
56+
Vendor ID: 0x05ac (Apple Inc.)
57+
Version: 0.41
58+
Speed: Up to 12 Mb/sec
59+
Manufacturer: Apple Inc.
60+
Location ID: 0x04530000 / 6
61+
Current Available (mA): 500
62+
Current Required (mA): 0
63+
64+
Apple Internal Keyboard / Trackpad:
65+
66+
Product ID: 0x0242
67+
Vendor ID: 0x05ac (Apple Inc.)
68+
Version: 1.07
69+
Speed: Up to 12 Mb/sec
70+
Manufacturer: Apple Inc.
71+
Location ID: 0x04300000 / 2
72+
Current Available (mA): 500
73+
Current Required (mA): 40
74+
75+
USB Bus:
76+
77+
Host Controller Location: Built-in USB
78+
Host Controller Driver: AppleUSBOHCI
79+
PCI Device ID: 0x0d9c
80+
PCI Revision ID: 0x00a1
81+
PCI Vendor ID: 0x10de
82+
Bus Number: 0x06
83+
84+
Arduino Yun:
85+
86+
Product ID: 0x8041
87+
Vendor ID: 0x2341
88+
Version: 1.00
89+
Speed: Up to 12 Mb/sec
90+
Manufacturer: Arduino LLC
91+
Location ID: 0x06200000 / 2
92+
Current Available (mA): 500
93+
Current Required (mA): 500
94+

hardware/arduino/avr/bootloaders/atmega/ATmegaBOOT_168.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,10 +950,10 @@ char getch(void)
950950
count++;
951951
if (count > MAX_TIME_COUNT)
952952
app_start();
953-
}
954-
955-
return UDR0;
956953
}
954+
955+
return UDR0;
956+
}
957957
else if(bootuart == 2) {
958958
while(!(UCSR1A & _BV(RXC1))) {
959959
/* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/

libraries/SD/src/File.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ File::File(void) {
4444
}
4545

4646
File::~File(void) {
47+
close();
4748
// Serial.print("Deleted file object");
4849
}
4950

0 commit comments

Comments
 (0)