mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-14 11:29:26 +01:00
Factoring Library class
This commit is contained in:
parent
5beea81ee2
commit
f8deaa5cfb
@ -37,7 +37,9 @@ import processing.app.helpers.Maps;
|
|||||||
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.app.helpers.filefilters.OnlyFilesWithExtension;
|
||||||
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;import processing.app.tools.MapWithSubkeys;
|
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;import processing.app.packages.Library;
|
||||||
|
import processing.app.packages.LibraryList;
|
||||||
|
import processing.app.tools.MapWithSubkeys;
|
||||||
import processing.app.tools.ZipDeflater;
|
import processing.app.tools.ZipDeflater;
|
||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
@ -89,10 +91,10 @@ public class Base {
|
|||||||
static private List<File> librariesFolders;
|
static private List<File> librariesFolders;
|
||||||
|
|
||||||
// maps library name to their library folder
|
// maps library name to their library folder
|
||||||
static private Map<String, File> libraries;
|
static private LibraryList libraries;
|
||||||
|
|
||||||
// maps #included files to their library folder
|
// maps #included files to their library folder
|
||||||
static Map<String, File> importToLibraryTable;
|
static Map<String, Library> importToLibraryTable;
|
||||||
|
|
||||||
// classpath for all known libraries for p5
|
// classpath for all known libraries for p5
|
||||||
// (both those in the p5/libs folder and those with lib subfolders
|
// (both those in the p5/libs folder and those with lib subfolders
|
||||||
@ -1038,26 +1040,26 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, File> getIDELibs() {
|
public LibraryList getIDELibs() {
|
||||||
|
LibraryList libs = new LibraryList();
|
||||||
if (libraries == null)
|
if (libraries == null)
|
||||||
return new HashMap<String, File>();
|
return libs;
|
||||||
Map<String, File> ideLibs = new HashMap<String, File>(libraries);
|
for (Library lib : libraries) {
|
||||||
for (String lib : libraries.keySet()) {
|
if (!FileUtils.isSubDirectory(getSketchbookFolder(), lib.getRootFolder()))
|
||||||
if (FileUtils.isSubDirectory(getSketchbookFolder(), libraries.get(lib)))
|
libs.add(lib);
|
||||||
ideLibs.remove(lib);
|
|
||||||
}
|
}
|
||||||
return ideLibs;
|
return libs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, File> getUserLibs() {
|
public LibraryList getUserLibs() {
|
||||||
|
LibraryList libs = new LibraryList();
|
||||||
if (libraries == null)
|
if (libraries == null)
|
||||||
return new HashMap<String, File>();
|
return libs;
|
||||||
Map<String, File> userLibs = new HashMap<String, File>(libraries);
|
for (Library lib : libraries) {
|
||||||
for (String lib : libraries.keySet()) {
|
if (FileUtils.isSubDirectory(getSketchbookFolder(), lib.getRootFolder()))
|
||||||
if (!FileUtils.isSubDirectory(getSketchbookFolder(), libraries.get(lib)))
|
libs.add(lib);
|
||||||
userLibs.remove(lib);
|
|
||||||
}
|
}
|
||||||
return userLibs;
|
return libs;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuildImportMenu(JMenu importMenu, final Editor editor) {
|
public void rebuildImportMenu(JMenu importMenu, final Editor editor) {
|
||||||
@ -1077,8 +1079,8 @@ public class Base {
|
|||||||
// Split between user supplied libraries and IDE libraries
|
// Split between user supplied libraries and IDE libraries
|
||||||
TargetPlatform targetPlatform = getTargetPlatform();
|
TargetPlatform targetPlatform = getTargetPlatform();
|
||||||
if (targetPlatform != null) {
|
if (targetPlatform != null) {
|
||||||
Map<String, File> ideLibs = getIDELibs();
|
LibraryList ideLibs = getIDELibs();
|
||||||
Map<String, File> userLibs = getUserLibs();
|
LibraryList userLibs = getUserLibs();
|
||||||
try {
|
try {
|
||||||
// Find the current target. Get the platform, and then select the
|
// Find the current target. Get the platform, and then select the
|
||||||
// correct name and core path.
|
// correct name and core path.
|
||||||
@ -1118,24 +1120,24 @@ public class Base {
|
|||||||
if (found) menu.addSeparator();
|
if (found) menu.addSeparator();
|
||||||
|
|
||||||
// Add examples from libraries
|
// Add examples from libraries
|
||||||
Map<String, File> ideLibs = getIDELibs();
|
LibraryList ideLibs = getIDELibs();
|
||||||
List<String> names = new ArrayList<String>(ideLibs.keySet());
|
Collections.sort(ideLibs, Library.CASE_INSENSITIVE_ORDER);
|
||||||
Collections.sort(names, String.CASE_INSENSITIVE_ORDER);
|
for (Library lib : ideLibs) {
|
||||||
for (String name : names) {
|
File folder = lib.getRootFolder();
|
||||||
File folder = ideLibs.get(name);
|
String name = lib.getName();
|
||||||
addSketchesSubmenu(menu, name, folder, false);
|
addSketchesSubmenu(menu, name, folder, false);
|
||||||
// Allows "fat" libraries to have examples in the root folder
|
// Allows "fat" libraries to have examples in the root folder
|
||||||
if (folder.getName().equals(Base.getTargetPlatform().getName()))
|
if (folder.getName().equals(Base.getTargetPlatform().getName()))
|
||||||
addSketchesSubmenu(menu, name, folder.getParentFile(), false);
|
addSketchesSubmenu(menu, name, folder.getParentFile(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, File> userLibs = getUserLibs();
|
LibraryList userLibs = getUserLibs();
|
||||||
if (userLibs.size()>0) {
|
if (userLibs.size()>0) {
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
names = new ArrayList<String>(userLibs.keySet());
|
Collections.sort(userLibs, Library.CASE_INSENSITIVE_ORDER);
|
||||||
Collections.sort(names, String.CASE_INSENSITIVE_ORDER);
|
for (Library lib : userLibs) {
|
||||||
for (String name : names) {
|
File folder = lib.getRootFolder();
|
||||||
File folder = userLibs.get(name);
|
String name = lib.getName();
|
||||||
addSketchesSubmenu(menu, name, folder, false);
|
addSketchesSubmenu(menu, name, folder, false);
|
||||||
// Allows "fat" libraries to have examples in the root folder
|
// Allows "fat" libraries to have examples in the root folder
|
||||||
if (folder.getName().equals(Base.getTargetPlatform().getName()))
|
if (folder.getName().equals(Base.getTargetPlatform().getName()))
|
||||||
@ -1147,15 +1149,16 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, File> scanLibraries(List<File> folders) {
|
public LibraryList scanLibraries(List<File> folders) {
|
||||||
Map<String, File> res = new HashMap<String, File>();
|
LibraryList res = new LibraryList();
|
||||||
for (File folder : folders)
|
for (File folder : folders)
|
||||||
res.putAll(scanLibraries(folder));
|
res.addAll(scanLibraries(folder));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, File> scanLibraries(File folder) {
|
public LibraryList scanLibraries(File folder) {
|
||||||
Map<String, File> res = new HashMap<String, File>();
|
LibraryList res = new LibraryList();
|
||||||
|
|
||||||
String list[] = folder.list(new OnlyDirs());
|
String list[] = folder.list(new OnlyDirs());
|
||||||
// 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)
|
if (list == null)
|
||||||
@ -1172,41 +1175,15 @@ public class Base {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
subfolder = scanFatLibrary(subfolder);
|
Library lib = Library.fromFolder(subfolder, Base.getTargetPlatform().getName());
|
||||||
|
|
||||||
// (also replace previously found libs with the same name)
|
// (also replace previously found libs with the same name)
|
||||||
if (subfolder != null)
|
if (lib != null)
|
||||||
res.put(libName, subfolder);
|
res.addOrReplace(lib);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Scans inside a "FAT" (multi-platform) library folder to see if it contains
|
|
||||||
* a version suitable for the actual selected architecture. If a suitable
|
|
||||||
* version is found the folder containing that version is returned, otherwise
|
|
||||||
* <b>null</b> is returned.<br />
|
|
||||||
* <br />
|
|
||||||
* If a non-"FAT" library is detected, we assume that the library is suitable
|
|
||||||
* for the current architecture and the libFolder parameter is returned.<br />
|
|
||||||
*
|
|
||||||
* @param libFolder
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public File scanFatLibrary(File libFolder) {
|
|
||||||
// A library is considered "fat" if it contains a file called
|
|
||||||
// "library.properties"
|
|
||||||
File libraryPropFile = new File(libFolder, "library.properties");
|
|
||||||
if (!libraryPropFile.exists() || !libraryPropFile.isFile())
|
|
||||||
return libFolder;
|
|
||||||
|
|
||||||
// Search for a subfolder for actual architecture, return null if not found
|
|
||||||
File archSubfolder = new File(libFolder, Base.getTargetPlatform().getName());
|
|
||||||
if (!archSubfolder.exists() || !archSubfolder.isDirectory())
|
|
||||||
return null;
|
|
||||||
return archSubfolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onBoardOrPortChange() {
|
public void onBoardOrPortChange() {
|
||||||
TargetPlatform targetPlatform = getTargetPlatform();
|
TargetPlatform targetPlatform = getTargetPlatform();
|
||||||
if (targetPlatform == null)
|
if (targetPlatform == null)
|
||||||
@ -1228,15 +1205,16 @@ public class Base {
|
|||||||
libraries = scanLibraries(librariesFolders);
|
libraries = scanLibraries(librariesFolders);
|
||||||
|
|
||||||
// Populate importToLibraryTable
|
// Populate importToLibraryTable
|
||||||
importToLibraryTable = new HashMap<String, File>();
|
importToLibraryTable = new HashMap<String, Library>();
|
||||||
for (File subfolder : libraries.values()) {
|
for (Library lib : libraries) {
|
||||||
try {
|
try {
|
||||||
String packages[] = headerListFromIncludePath(subfolder);
|
String headers[] = headerListFromIncludePath(lib.getRootFolder());
|
||||||
for (String pkg : packages) {
|
for (String header : headers) {
|
||||||
importToLibraryTable.put(pkg, subfolder);
|
importToLibraryTable.put(header, lib);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", subfolder), e);
|
showWarning(_("Error"), I18n
|
||||||
|
.format("Unable to list header files in {0}", lib.getRootFolder()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1580,10 +1558,10 @@ public class Base {
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addLibraries(JMenu menu, Map<String, File> libs) throws IOException {
|
protected void addLibraries(JMenu menu, LibraryList libs) throws IOException {
|
||||||
|
|
||||||
List<String> list = new ArrayList<String>(libs.keySet());
|
LibraryList list = new LibraryList(libs);
|
||||||
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
|
Collections.sort(list, Library.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
ActionListener listener = new ActionListener() {
|
ActionListener listener = new ActionListener() {
|
||||||
public void actionPerformed(ActionEvent event) {
|
public void actionPerformed(ActionEvent event) {
|
||||||
@ -1596,11 +1574,11 @@ public class Base {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (String name : list) {
|
for (Library lib : list) {
|
||||||
File folder = libs.get(name);
|
File folder = lib.getRootFolder();
|
||||||
|
|
||||||
// Add new element at the bottom
|
// Add new element at the bottom
|
||||||
JMenuItem item = new JMenuItem(name);
|
JMenuItem item = new JMenuItem(lib.getName());
|
||||||
item.addActionListener(listener);
|
item.addActionListener(listener);
|
||||||
item.setActionCommand(folder.getAbsolutePath());
|
item.setActionCommand(folder.getAbsolutePath());
|
||||||
menu.add(item);
|
menu.add(item);
|
||||||
@ -1874,7 +1852,7 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static public Map<String, File> getLibraries() {
|
static public LibraryList getLibraries() {
|
||||||
return libraries;
|
return libraries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@ import processing.app.debug.RunnerException;
|
|||||||
import processing.app.debug.Sizer;
|
import processing.app.debug.Sizer;
|
||||||
import processing.app.debug.Uploader;
|
import processing.app.debug.Uploader;
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
|
import processing.app.packages.Library;
|
||||||
|
import processing.app.packages.LibraryList;
|
||||||
import processing.app.preproc.*;
|
import processing.app.preproc.*;
|
||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
@ -96,7 +98,7 @@ public class Sketch {
|
|||||||
/**
|
/**
|
||||||
* List of library folders.
|
* List of library folders.
|
||||||
*/
|
*/
|
||||||
private ArrayList<File> importedLibraries;
|
private LibraryList importedLibraries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path is location of the main .pde file, because this is also
|
* path is location of the main .pde file, because this is also
|
||||||
@ -1421,18 +1423,18 @@ public class Sketch {
|
|||||||
|
|
||||||
// grab the imports from the code just preproc'd
|
// grab the imports from the code just preproc'd
|
||||||
|
|
||||||
importedLibraries = new ArrayList<File>();
|
importedLibraries = new LibraryList();
|
||||||
//Remember to clear library path before building it.
|
//Remember to clear library path before building it.
|
||||||
libraryPath = "";
|
libraryPath = "";
|
||||||
for (String item : preprocessor.getExtraImports()) {
|
for (String item : preprocessor.getExtraImports()) {
|
||||||
|
|
||||||
File libFolder = (File) Base.importToLibraryTable.get(item);
|
Library lib = Base.importToLibraryTable.get(item);
|
||||||
//If needed can Debug libraryPath here
|
//If needed can Debug libraryPath here
|
||||||
|
|
||||||
if (libFolder != null && !importedLibraries.contains(libFolder)) {
|
if (lib != null && !importedLibraries.contains(lib)) {
|
||||||
importedLibraries.add(libFolder);
|
importedLibraries.add(lib);
|
||||||
//classPath += Compiler.contentsToClassPath(libFolder);
|
//classPath += Compiler.contentsToClassPath(libFolder);
|
||||||
libraryPath += File.pathSeparator + libFolder.getAbsolutePath();
|
libraryPath += File.pathSeparator + lib.getRootFolder().getAbsolutePath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1462,7 +1464,7 @@ public class Sketch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<File> getImportedLibraries() {
|
public LibraryList getImportedLibraries() {
|
||||||
return importedLibraries;
|
return importedLibraries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ import processing.app.SketchCode;
|
|||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
import processing.app.helpers.StringReplacer;
|
import processing.app.helpers.StringReplacer;
|
||||||
import processing.app.helpers.filefilters.OnlyDirs;
|
import processing.app.helpers.filefilters.OnlyDirs;
|
||||||
|
import processing.app.packages.Library;
|
||||||
import processing.core.PApplet;
|
import processing.core.PApplet;
|
||||||
|
|
||||||
public class Compiler implements MessageConsumer {
|
public class Compiler implements MessageConsumer {
|
||||||
@ -84,8 +85,8 @@ public class Compiler implements MessageConsumer {
|
|||||||
includePaths.add(prefs.get("build.core.path"));
|
includePaths.add(prefs.get("build.core.path"));
|
||||||
if (prefs.get("build.variant.path").length() != 0)
|
if (prefs.get("build.variant.path").length() != 0)
|
||||||
includePaths.add(prefs.get("build.variant.path"));
|
includePaths.add(prefs.get("build.variant.path"));
|
||||||
for (File file : sketch.getImportedLibraries())
|
for (Library lib : sketch.getImportedLibraries())
|
||||||
includePaths.add(file.getPath());
|
includePaths.add(lib.getRootFolder().getPath());
|
||||||
|
|
||||||
// 1. compile the sketch (already in the buildPath)
|
// 1. compile the sketch (already in the buildPath)
|
||||||
sketch.setCompilingProgress(30);
|
sketch.setCompilingProgress(30);
|
||||||
@ -580,11 +581,12 @@ public class Compiler implements MessageConsumer {
|
|||||||
// <buildPath>/<library>/
|
// <buildPath>/<library>/
|
||||||
void compileLibraries(List<String> includePaths) throws RunnerException {
|
void compileLibraries(List<String> includePaths) throws RunnerException {
|
||||||
File outputPath = new File(prefs.get("build.path"));
|
File outputPath = new File(prefs.get("build.path"));
|
||||||
for (File libraryFolder : sketch.getImportedLibraries()) {
|
for (Library lib : sketch.getImportedLibraries()) {
|
||||||
if (new File(libraryFolder.getParentFile(), "library.properties").exists()) {
|
File libFolder = lib.getRootFolder();
|
||||||
recursiveCompileLibrary(outputPath, libraryFolder, includePaths);
|
if (lib.isNewLib()) {
|
||||||
|
recursiveCompileLibrary(outputPath, libFolder, includePaths);
|
||||||
} else {
|
} else {
|
||||||
compileLibrary(outputPath, libraryFolder, includePaths);
|
compileLibrary(outputPath, libFolder, includePaths);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
79
app/src/processing/app/packages/Library.java
Normal file
79
app/src/processing/app/packages/Library.java
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
package processing.app.packages;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Library {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private File folder;
|
||||||
|
private List<String> architectures;
|
||||||
|
private boolean oldLib = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scans inside a library folder to see if it contains a version suitable for
|
||||||
|
* the actual selected architecture. If a suitable version is found the folder
|
||||||
|
* containing that version is selected, otherwise <b>null</b> is selected.<br />
|
||||||
|
* <br />
|
||||||
|
* If an old-style library is detected, we assume that the library is suitable
|
||||||
|
* for the current architecture and the libFolder parameter is used.<br />
|
||||||
|
*
|
||||||
|
* @param libFolder
|
||||||
|
* @param arch
|
||||||
|
* Currently selected architecture
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
static public Library fromFolder(File libFolder, String arch) {
|
||||||
|
// A library is considered "new" if it contains a file called
|
||||||
|
// "library.properties"
|
||||||
|
File libraryPropFile = new File(libFolder, "library.properties");
|
||||||
|
if (!libraryPropFile.exists() || !libraryPropFile.isFile()) {
|
||||||
|
// construct an old style library
|
||||||
|
Library res = new Library();
|
||||||
|
res.folder = libFolder;
|
||||||
|
res.name = libFolder.getName();
|
||||||
|
res.oldLib = true;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search for a subfolder for actual architecture, return null if not found
|
||||||
|
File archSubfolder = new File(libFolder, arch);
|
||||||
|
if (!archSubfolder.exists() || !archSubfolder.isDirectory())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
Library res = new Library();
|
||||||
|
res.folder = archSubfolder;
|
||||||
|
res.name = libFolder.getName();
|
||||||
|
res.oldLib = false;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getRootFolder() {
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String _name) {
|
||||||
|
name = _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Comparator<Library> CASE_INSENSITIVE_ORDER = new Comparator<Library>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Library o1, Library o2) {
|
||||||
|
return o1.getName().compareToIgnoreCase(o2.getName());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public boolean isOldLib() {
|
||||||
|
return oldLib;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isNewLib() {
|
||||||
|
return !oldLib;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
30
app/src/processing/app/packages/LibraryList.java
Normal file
30
app/src/processing/app/packages/LibraryList.java
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
package processing.app.packages;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class LibraryList extends ArrayList<Library> {
|
||||||
|
|
||||||
|
public LibraryList(LibraryList libs) {
|
||||||
|
super(libs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryList() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Library getByName(String name) {
|
||||||
|
for (Library l : this)
|
||||||
|
if (l.getName().equals(name))
|
||||||
|
return l;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOrReplace(Library lib) {
|
||||||
|
Library l = getByName(lib.getName());
|
||||||
|
if (l != null)
|
||||||
|
remove(l);
|
||||||
|
add(lib);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -25,6 +25,7 @@
|
|||||||
package processing.app.syntax;
|
package processing.app.syntax;
|
||||||
|
|
||||||
import processing.app.*;
|
import processing.app.*;
|
||||||
|
import processing.app.packages.Library;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -59,8 +60,8 @@ public class PdeKeywords extends CTokenMarker {
|
|||||||
keywordColoring = new KeywordMap(false);
|
keywordColoring = new KeywordMap(false);
|
||||||
keywordToReference = new Hashtable();
|
keywordToReference = new Hashtable();
|
||||||
getKeywords(Base.getLibStream("keywords.txt"));
|
getKeywords(Base.getLibStream("keywords.txt"));
|
||||||
for (File lib : Base.getLibraries().values()) {
|
for (Library lib : Base.getLibraries()) {
|
||||||
File keywords = new File(lib, "keywords.txt");
|
File keywords = new File(lib.getRootFolder(), "keywords.txt");
|
||||||
if (keywords.exists()) getKeywords(new FileInputStream(keywords));
|
if (keywords.exists()) getKeywords(new FileInputStream(keywords));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user