Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a506756

Browse filesBrowse files
author
Federico Fissore
committed
1 parent cce70d2 commit a506756
Copy full SHA for a506756

File tree

Expand file treeCollapse file tree

3 files changed

+19
-6
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+19
-6
lines changed

‎app/src/processing/app/Base.java

Copy file name to clipboardExpand all lines: app/src/processing/app/Base.java
+11-2Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,8 +1182,13 @@ public boolean accept(File dir, String name) {
11821182
Arrays.sort(list, String.CASE_INSENSITIVE_ORDER);
11831183

11841184
ActionListener listener = new ActionListener() {
1185-
public void actionPerformed(ActionEvent e) {
1186-
activeEditor.getSketch().importLibrary(e.getActionCommand());
1185+
public void actionPerformed(ActionEvent event) {
1186+
String jarPath = event.getActionCommand();
1187+
try {
1188+
activeEditor.getSketch().importLibrary(jarPath);
1189+
} catch (IOException e) {
1190+
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", jarPath), e);
1191+
}
11871192
}
11881193
};
11891194

@@ -1220,11 +1225,15 @@ public void actionPerformed(ActionEvent e) {
12201225
// String packages[] =
12211226
// Compiler.packageListFromClassPath(libraryClassPath);
12221227
libraries.add(subfolder);
1228+
try {
12231229
String packages[] =
12241230
Compiler.headerListFromIncludePath(subfolder.getAbsolutePath());
12251231
for (String pkg : packages) {
12261232
importToLibraryTable.put(pkg, subfolder);
12271233
}
1234+
} catch (IOException e) {
1235+
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", subfolder), e);
1236+
}
12281237

12291238
JMenuItem item = new JMenuItem(libraryName);
12301239
item.addActionListener(listener);

‎app/src/processing/app/Sketch.java

Copy file name to clipboardExpand all lines: app/src/processing/app/Sketch.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,7 +1128,7 @@ public boolean addFile(File sourceFile) {
11281128
* Add import statements to the current tab for all of packages inside
11291129
* the specified jar file.
11301130
*/
1131-
public void importLibrary(String jarPath) {
1131+
public void importLibrary(String jarPath) throws IOException {
11321132
// make sure the user didn't hide the sketch folder
11331133
ensureExistence();
11341134

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

Copy file name to clipboardExpand all lines: app/src/processing/app/debug/Compiler.java
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,14 +644,18 @@ static private void createFolder(File folder) throws RunnerException {
644644
* not the header files in its sub-folders, as those should be included from
645645
* within the header files at the top-level).
646646
*/
647-
static public String[] headerListFromIncludePath(String path) {
647+
static public String[] headerListFromIncludePath(String path) throws IOException {
648648
FilenameFilter onlyHFiles = new FilenameFilter() {
649649
public boolean accept(File dir, String name) {
650650
return name.endsWith(".h");
651651
}
652652
};
653-
654-
return (new File(path)).list(onlyHFiles);
653+
654+
String[] list = (new File(path)).list(onlyHFiles);
655+
if (list == null) {
656+
throw new IOException();
657+
}
658+
return list;
655659
}
656660

657661
static public ArrayList<File> findFilesInPath(String path, String extension,

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.