mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-03 14:24:15 +01:00
Moved libraries folder inside platform folder. Now libraries and examples are searched per board/platform
This commit is contained in:
parent
387e6b63c7
commit
57b8713cab
@ -30,11 +30,11 @@ import java.util.List;
|
|||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
|
||||||
import processing.app.debug.Compiler;
|
|
||||||
import processing.app.debug.TargetPackage;
|
import processing.app.debug.TargetPackage;
|
||||||
import processing.app.debug.TargetPlatform;
|
import processing.app.debug.TargetPlatform;
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
import processing.app.helpers.filefilters.OnlyDirs;
|
import processing.app.helpers.filefilters.OnlyDirs;
|
||||||
|
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
@ -237,12 +237,6 @@ public class Base {
|
|||||||
public Base(String[] args) {
|
public Base(String[] args) {
|
||||||
platform.init(this);
|
platform.init(this);
|
||||||
|
|
||||||
// Get paths for the libraries and examples in the Processing folder
|
|
||||||
//String workingDirectory = System.getProperty("user.dir");
|
|
||||||
examplesFolder = getContentFile("examples");
|
|
||||||
librariesFolder = getContentFile("libraries");
|
|
||||||
toolsFolder = getContentFile("tools");
|
|
||||||
|
|
||||||
// Get the sketchbook path, and make sure it's set properly
|
// Get the sketchbook path, and make sure it's set properly
|
||||||
String sketchbookPath = Preferences.get("sketchbook.path");
|
String sketchbookPath = Preferences.get("sketchbook.path");
|
||||||
|
|
||||||
@ -273,6 +267,8 @@ public class Base {
|
|||||||
packages = new HashMap<String, TargetPackage>();
|
packages = new HashMap<String, TargetPackage>();
|
||||||
loadHardware(getHardwareFolder());
|
loadHardware(getHardwareFolder());
|
||||||
loadHardware(getSketchbookHardwareFolder());
|
loadHardware(getSketchbookHardwareFolder());
|
||||||
|
// Setup board-dependent variables.
|
||||||
|
onBoardOrPortChange();
|
||||||
|
|
||||||
// Check if there were previously opened sketches to be restored
|
// Check if there were previously opened sketches to be restored
|
||||||
boolean opened = restoreSketches();
|
boolean opened = restoreSketches();
|
||||||
@ -302,7 +298,7 @@ public class Base {
|
|||||||
handleNew();
|
handleNew();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for updates
|
// Check for updates
|
||||||
if (Preferences.getBoolean("update.check")) {
|
if (Preferences.getBoolean("update.check")) {
|
||||||
new UpdateCheck(this);
|
new UpdateCheck(this);
|
||||||
}
|
}
|
||||||
@ -942,7 +938,6 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void rebuildImportMenu(JMenu importMenu) {
|
public void rebuildImportMenu(JMenu importMenu) {
|
||||||
// System.out.println("rebuilding import menu");
|
|
||||||
importMenu.removeAll();
|
importMenu.removeAll();
|
||||||
|
|
||||||
// reset the set of libraries
|
// reset the set of libraries
|
||||||
@ -959,13 +954,12 @@ public class Base {
|
|||||||
// correct name and core path.
|
// correct name and core path.
|
||||||
PreferencesMap prefs = getTargetPlatform().getPreferences();
|
PreferencesMap prefs = getTargetPlatform().getPreferences();
|
||||||
String targetname = prefs.get("name");
|
String targetname = prefs.get("name");
|
||||||
String libraryPath = prefs.get("library.core.path");
|
|
||||||
|
|
||||||
JMenuItem platformItem = new JMenuItem(targetname);
|
JMenuItem platformItem = new JMenuItem(targetname);
|
||||||
platformItem.setEnabled(false);
|
platformItem.setEnabled(false);
|
||||||
importMenu.add(platformItem);
|
importMenu.add(platformItem);
|
||||||
importMenu.addSeparator();
|
importMenu.addSeparator();
|
||||||
addLibraries(importMenu, getCoreLibraries(libraryPath));
|
addLibraries(importMenu, librariesFolder);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -1002,6 +996,15 @@ public class Base {
|
|||||||
|
|
||||||
|
|
||||||
public void onBoardOrPortChange() {
|
public void onBoardOrPortChange() {
|
||||||
|
// Calculate paths for libraries and examples
|
||||||
|
examplesFolder = getContentFile("examples");
|
||||||
|
TargetPlatform targetPlatform = getTargetPlatform();
|
||||||
|
PreferencesMap prefs = targetPlatform.getPreferences();
|
||||||
|
librariesFolder = new File(targetPlatform.getFolder(), prefs
|
||||||
|
.get("library.core.path"));
|
||||||
|
toolsFolder = getContentFile("tools");
|
||||||
|
|
||||||
|
// Update editors status bar
|
||||||
for (Editor editor : editors) {
|
for (Editor editor : editors) {
|
||||||
editor.onBoardOrPortChange();
|
editor.onBoardOrPortChange();
|
||||||
}
|
}
|
||||||
@ -1010,32 +1013,44 @@ public class Base {
|
|||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public void rebuildBoardsMenu(JMenu menu) {
|
public void rebuildBoardsMenu(JMenu menu) {
|
||||||
//System.out.println("rebuilding boards menu");
|
String selPackage = Preferences.get("target_package");
|
||||||
|
String selPlatform = Preferences.get("target_platform");
|
||||||
|
String selBoard = Preferences.get("board");
|
||||||
|
|
||||||
menu.removeAll();
|
menu.removeAll();
|
||||||
ButtonGroup group = new ButtonGroup();
|
ButtonGroup group = new ButtonGroup();
|
||||||
|
// Cycle through all packages
|
||||||
for (TargetPackage targetPackage : packages.values()) {
|
for (TargetPackage targetPackage : packages.values()) {
|
||||||
|
String packageName = targetPackage.getName();
|
||||||
|
|
||||||
|
// For every package cycle through all platform
|
||||||
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
||||||
for (String board : targetPlatform.getBoards().keySet()) {
|
String platformName = targetPlatform.getName();
|
||||||
AbstractAction action = new AbstractAction(targetPlatform.getBoards().get(
|
Map<String, PreferencesMap> boards = targetPlatform.getBoards();
|
||||||
board).get("name")) {
|
|
||||||
|
// For every platform cycle throug all boards
|
||||||
|
for (String board : boards.keySet()) {
|
||||||
|
|
||||||
|
// Setup a menu item for the current board
|
||||||
|
String boardName = boards.get(board).get("name");
|
||||||
|
AbstractAction action = new AbstractAction(boardName) {
|
||||||
public void actionPerformed(ActionEvent actionevent) {
|
public void actionPerformed(ActionEvent actionevent) {
|
||||||
// System.out.println("Switching to " + target + ":" + board);
|
Preferences.set("target_package", (String) getValue("package"));
|
||||||
Preferences.set("package", (String) getValue("package"));
|
Preferences.set("target_platform", (String) getValue("platform"));
|
||||||
Preferences.set("platform", (String) getValue("platform"));
|
|
||||||
Preferences.set("board", (String) getValue("board"));
|
Preferences.set("board", (String) getValue("board"));
|
||||||
|
|
||||||
onBoardOrPortChange();
|
onBoardOrPortChange();
|
||||||
Sketch.buildSettingChanged();
|
Sketch.buildSettingChanged();
|
||||||
// Debug: created new imports menu based on board
|
rebuildImportMenu(Editor.importMenu);
|
||||||
rebuildImportMenu(activeEditor.importMenu);
|
rebuildExamplesMenu(Editor.examplesMenu);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
action.putValue("package", targetPackage.getName());
|
action.putValue("package", packageName);
|
||||||
action.putValue("platform", targetPlatform.getName());
|
action.putValue("platform", platformName);
|
||||||
action.putValue("board", board);
|
action.putValue("board", board);
|
||||||
JMenuItem item = new JRadioButtonMenuItem(action);
|
JMenuItem item = new JRadioButtonMenuItem(action);
|
||||||
if (targetPackage.getName().equals(Preferences.get("package"))
|
if (packageName.equals(selPackage) &&
|
||||||
&& targetPlatform.getName().equals(Preferences.get("platform"))
|
platformName.equals(selPlatform) && board.equals(selBoard)) {
|
||||||
&& board.equals(Preferences.get("board"))) {
|
|
||||||
item.setSelected(true);
|
item.setSelected(true);
|
||||||
}
|
}
|
||||||
group.add(item);
|
group.add(item);
|
||||||
@ -1045,26 +1060,21 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public void rebuildProgrammerMenu(JMenu menu) {
|
public void rebuildProgrammerMenu(JMenu menu) {
|
||||||
//System.out.println("rebuilding programmer menu");
|
|
||||||
menu.removeAll();
|
menu.removeAll();
|
||||||
ButtonGroup group = new ButtonGroup();
|
ButtonGroup group = new ButtonGroup();
|
||||||
for (TargetPackage targetPackage : packages.values()) {
|
for (TargetPackage targetPackage : packages.values()) {
|
||||||
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
for (TargetPlatform targetPlatform : targetPackage.platforms()) {
|
||||||
for (String programmer : targetPlatform.getProgrammers().keySet()) {
|
for (String programmer : targetPlatform.getProgrammers().keySet()) {
|
||||||
String id = targetPackage.getName() + ":" + targetPlatform.getName() + ":"
|
String id = targetPackage.getName() + ":" + targetPlatform.getName() +
|
||||||
+ programmer;
|
":" + programmer;
|
||||||
AbstractAction action = new AbstractAction(targetPlatform.getProgrammers()
|
AbstractAction action = new AbstractAction(targetPlatform
|
||||||
.get(programmer).get("name")) {
|
.getProgrammers().get(programmer).get("name")) {
|
||||||
public void actionPerformed(ActionEvent actionevent) {
|
public void actionPerformed(ActionEvent actionevent) {
|
||||||
Preferences.set("programmer", "" + getValue("id"));
|
Preferences.set("programmer", "" + getValue("id"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// action.putValue("package", targetPackage.getName());
|
|
||||||
// action.putValue("platform", targetPlatform.getName());
|
|
||||||
// action.putValue("programmer", programmer);
|
|
||||||
action.putValue("id", id);
|
action.putValue("id", id);
|
||||||
JMenuItem item = new JRadioButtonMenuItem(action);
|
JMenuItem item = new JRadioButtonMenuItem(action);
|
||||||
if (Preferences.get("programmer").equals(id))
|
if (Preferences.get("programmer").equals(id))
|
||||||
@ -1076,7 +1086,6 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan a folder recursively, and add any sketches found to the menu
|
* Scan a folder recursively, and add any sketches found to the menu
|
||||||
* specified. Set the openReplaces parameter to true when opening the sketch
|
* specified. Set the openReplaces parameter to true when opening the sketch
|
||||||
@ -1112,9 +1121,9 @@ public class Base {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showWarning(_("Sketch Does Not Exist"),
|
showWarning(_("Sketch Does Not Exist"),
|
||||||
_("The selected sketch no longer exists.\n" +
|
_("The selected sketch no longer exists.\n"
|
||||||
"You may need to restart Arduino to update\n" +
|
+ "You may need to restart Arduino to update\n"
|
||||||
"the sketchbook menu."), null);
|
+ "the sketchbook menu."), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -1183,18 +1192,13 @@ public class Base {
|
|||||||
|
|
||||||
|
|
||||||
protected boolean addLibraries(JMenu menu, File folder) throws IOException {
|
protected boolean addLibraries(JMenu menu, File folder) throws IOException {
|
||||||
if (!folder.isDirectory()) return false;
|
if (!folder.isDirectory())
|
||||||
|
return false;
|
||||||
|
|
||||||
String list[] = folder.list(new FilenameFilter() {
|
String list[] = folder.list(new OnlyDirs());
|
||||||
public boolean accept(File dir, String name) {
|
|
||||||
// skip .DS_Store files, .svn folders, etc
|
|
||||||
if (name.charAt(0) == '.') return false;
|
|
||||||
if (name.equals("CVS")) return false;
|
|
||||||
return (new File(dir, name).isDirectory());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
// if a bad folder or something like that, this might come back null
|
// if a bad folder or something like that, this might come back null
|
||||||
if (list == null) return false;
|
if (list == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
// alphabetize list, since it's not always alpha order
|
// alphabetize list, since it's not always alpha order
|
||||||
// replaced hella slow bubble sort with this feller for 0093
|
// replaced hella slow bubble sort with this feller for 0093
|
||||||
@ -1206,41 +1210,23 @@ public class Base {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
boolean ifound = false;
|
boolean found = false;
|
||||||
|
|
||||||
for (String potentialName : list) {
|
for (String libraryName : list) {
|
||||||
File subfolder = new File(folder, potentialName);
|
File subfolder = new File(folder, libraryName);
|
||||||
// File libraryFolder = new File(subfolder, "library");
|
String sanityCheck = Sketch.sanitizeName(libraryName);
|
||||||
// File libraryJar = new File(libraryFolder, potentialName + ".jar");
|
if (!sanityCheck.equals(libraryName)) {
|
||||||
// // If a .jar file of the same prefix as the folder exists
|
String mess = I18n.format(_("The library \"{0}\" cannot be used.\n"
|
||||||
// // inside the 'library' subfolder of the sketch
|
+ "Library names must contain only basic letters and numbers.\n"
|
||||||
// if (libraryJar.exists()) {
|
+ "(ASCII only and no spaces, and it cannot start with a number)"),
|
||||||
String sanityCheck = Sketch.sanitizeName(potentialName);
|
libraryName);
|
||||||
if (!sanityCheck.equals(potentialName)) {
|
|
||||||
String mess = I18n.format(
|
|
||||||
_("The library \"{0}\" cannot be used.\n" +
|
|
||||||
"Library names must contain only basic letters and numbers.\n" +
|
|
||||||
"(ASCII only and no spaces, and it cannot start with a number)"),
|
|
||||||
potentialName
|
|
||||||
);
|
|
||||||
Base.showMessage(_("Ignoring bad library name"), mess);
|
Base.showMessage(_("Ignoring bad library name"), mess);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String libraryName = potentialName;
|
|
||||||
// // get the path for all .jar files in this code folder
|
|
||||||
// String libraryClassPath =
|
|
||||||
// Compiler.contentsToClassPath(libraryFolder);
|
|
||||||
// // grab all jars and classes from this folder,
|
|
||||||
// // and append them to the library classpath
|
|
||||||
// librariesClassPath +=
|
|
||||||
// File.pathSeparatorChar + libraryClassPath;
|
|
||||||
// // need to associate each import with a library folder
|
|
||||||
// String packages[] =
|
|
||||||
// Compiler.packageListFromClassPath(libraryClassPath);
|
|
||||||
libraries.add(subfolder);
|
libraries.add(subfolder);
|
||||||
String packages[] =
|
|
||||||
Compiler.headerListFromIncludePath(subfolder.getAbsolutePath());
|
String packages[] = headerListFromIncludePath(subfolder);
|
||||||
for (String pkg : packages) {
|
for (String pkg : packages) {
|
||||||
importToLibraryTable.put(pkg, subfolder);
|
importToLibraryTable.put(pkg, subfolder);
|
||||||
}
|
}
|
||||||
@ -1249,22 +1235,21 @@ public class Base {
|
|||||||
item.addActionListener(listener);
|
item.addActionListener(listener);
|
||||||
item.setActionCommand(subfolder.getAbsolutePath());
|
item.setActionCommand(subfolder.getAbsolutePath());
|
||||||
menu.add(item);
|
menu.add(item);
|
||||||
ifound = true;
|
found = true;
|
||||||
|
|
||||||
// XXX: DAM: should recurse here so that library folders can be nested
|
// XXX: DAM: should recurse here so that library folders can be nested
|
||||||
// } else { // not a library, but is still a folder, so recurse
|
|
||||||
// JMenu submenu = new JMenu(libraryName);
|
|
||||||
// // needs to be separate var, otherwise would set ifound to false
|
|
||||||
// boolean found = addLibraries(submenu, subfolder);
|
|
||||||
// if (found) {
|
|
||||||
// menu.add(submenu);
|
|
||||||
// ifound = true;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
return ifound;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a folder, return a list of the header files in that folder (but not
|
||||||
|
* the header files in its sub-folders, as those should be included from
|
||||||
|
* within the header files at the top-level).
|
||||||
|
*/
|
||||||
|
static public String[] headerListFromIncludePath(File path) {
|
||||||
|
return path.list(new OnlyFilesWithExtension(".h"));
|
||||||
|
}
|
||||||
|
|
||||||
protected void loadHardware(File folder) {
|
protected void loadHardware(File folder) {
|
||||||
if (!folder.isDirectory()) return;
|
if (!folder.isDirectory()) return;
|
||||||
@ -1291,6 +1276,7 @@ public class Base {
|
|||||||
/**
|
/**
|
||||||
* Show the About box.
|
* Show the About box.
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("serial")
|
||||||
public void handleAbout() {
|
public void handleAbout() {
|
||||||
final Image image = Base.getLibImage("about.jpg", activeEditor);
|
final Image image = Base.getLibImage("about.jpg", activeEditor);
|
||||||
final Window window = new Window(activeEditor) {
|
final Window window = new Window(activeEditor) {
|
||||||
@ -1588,12 +1574,9 @@ public class Base {
|
|||||||
|
|
||||||
static public PreferencesMap getBoardPreferences() {
|
static public PreferencesMap getBoardPreferences() {
|
||||||
TargetPlatform target = getTargetPlatform();
|
TargetPlatform target = getTargetPlatform();
|
||||||
if (target != null) {
|
|
||||||
String board = Preferences.get("board");
|
String board = Preferences.get("board");
|
||||||
return target.getBoards().get(board);
|
return target.getBoards().get(board);
|
||||||
}
|
}
|
||||||
return new PreferencesMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
static public File getSketchbookFolder() {
|
static public File getSketchbookFolder() {
|
||||||
return new File(Preferences.get("sketchbook.path"));
|
return new File(Preferences.get("sketchbook.path"));
|
||||||
|
@ -33,16 +33,11 @@ import processing.core.*;
|
|||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.*;
|
|
||||||
import java.beans.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.zip.*;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import javax.swing.border.EmptyBorder;
|
|
||||||
import javax.swing.border.TitledBorder;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1132,7 +1127,7 @@ public class Sketch {
|
|||||||
// make sure the user didn't hide the sketch folder
|
// make sure the user didn't hide the sketch folder
|
||||||
ensureExistence();
|
ensureExistence();
|
||||||
|
|
||||||
String list[] = Compiler.headerListFromIncludePath(jarPath);
|
String list[] = Base.headerListFromIncludePath(new File(jarPath));
|
||||||
|
|
||||||
// import statements into the main sketch file (code[0])
|
// import statements into the main sketch file (code[0])
|
||||||
// if the current code is a .java file, insert into current
|
// if the current code is a .java file, insert into current
|
||||||
|
@ -28,7 +28,6 @@ import static processing.app.I18n._;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FilenameFilter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -120,7 +119,6 @@ public class Compiler implements MessageConsumer {
|
|||||||
re.hideStackTrace();
|
re.hideStackTrace();
|
||||||
throw re;
|
throw re;
|
||||||
}
|
}
|
||||||
|
|
||||||
File coreFolder;
|
File coreFolder;
|
||||||
if (!core.contains(":")) {
|
if (!core.contains(":")) {
|
||||||
TargetPlatform t = Base.getTargetPlatform();
|
TargetPlatform t = Base.getTargetPlatform();
|
||||||
@ -538,21 +536,6 @@ public class Compiler implements MessageConsumer {
|
|||||||
throw new RunnerException("Couldn't create: " + folder);
|
throw new RunnerException("Couldn't create: " + folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Given a folder, return a list of the header files in that folder (but not
|
|
||||||
* the header files in its sub-folders, as those should be included from
|
|
||||||
* within the header files at the top-level).
|
|
||||||
*/
|
|
||||||
static public String[] headerListFromIncludePath(String path) {
|
|
||||||
FilenameFilter onlyHFiles = new FilenameFilter() {
|
|
||||||
public boolean accept(File dir, String name) {
|
|
||||||
return name.endsWith(".h");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (new File(path)).list(onlyHFiles);
|
|
||||||
}
|
|
||||||
|
|
||||||
static public List<File> findFilesInFolder(File folder, String extension,
|
static public List<File> findFilesInFolder(File folder, String extension,
|
||||||
boolean recurse) {
|
boolean recurse) {
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
OnlyFilesWithExtension - FilenameFilter that accepts only files with a
|
||||||
|
specific extension.
|
||||||
|
Part of the Arduino project - http://www.arduino.cc/
|
||||||
|
|
||||||
|
Copyright (c) 2011 Cristian Maglie
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
*/
|
||||||
|
package processing.app.helpers.filefilters;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FilenameFilter;
|
||||||
|
|
||||||
|
public class OnlyFilesWithExtension implements FilenameFilter {
|
||||||
|
|
||||||
|
String extensions[];
|
||||||
|
|
||||||
|
public OnlyFilesWithExtension(String... ext) {
|
||||||
|
extensions = ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean accept(File dir, String name) {
|
||||||
|
for (String ext : extensions)
|
||||||
|
if (name.endsWith(ext))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -81,11 +81,6 @@
|
|||||||
<fileset dir="shared/tools" />
|
<fileset dir="shared/tools" />
|
||||||
</copy>
|
</copy>
|
||||||
|
|
||||||
<!-- copy library folder -->
|
|
||||||
<copy todir="${target.path}/libraries">
|
|
||||||
<fileset dir="../libraries" />
|
|
||||||
</copy>
|
|
||||||
|
|
||||||
<!-- copy hardware folder -->
|
<!-- copy hardware folder -->
|
||||||
<copy todir="${target.path}/hardware">
|
<copy todir="${target.path}/hardware">
|
||||||
<fileset dir="../hardware" />
|
<fileset dir="../hardware" />
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user