1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Adding support for user-installed libraries in the "libraries" sub-directory of the sketchbook folder.

This commit is contained in:
David A. Mellis
2009-05-24 15:09:26 +00:00
parent 07feaca3a1
commit c2cac3e75d
3 changed files with 23 additions and 7 deletions

View File

@ -68,6 +68,9 @@ public class Sketchbook {
static File librariesFolder;
static String librariesPath;
static File userLibrariesFolder;
static String userLibrariesPath;
// maps imported packages to their library folder
static Hashtable importToLibraryTable = new Hashtable();
@ -131,11 +134,14 @@ public class Sketchbook {
//System.out.println("resetting sketchbook path");
File sketchbookFolder = Base.getDefaultSketchbookFolder();
//System.out.println("default is " + sketchbookFolder);
Preferences.set("sketchbook.path",
sketchbookFolder.getAbsolutePath());
sketchbookPath = sketchbookFolder.getAbsolutePath();
Preferences.set("sketchbook.path", sketchbookPath);
if (!sketchbookFolder.exists()) sketchbookFolder.mkdirs();
}
userLibrariesFolder = new File(sketchbookPath, "libraries");
userLibrariesPath = userLibrariesFolder.getAbsolutePath();
openMenu = new JMenu("Sketchbook");
popupMenu = new JMenu("Sketchbook");
importMenu = new JMenu("Import Library");
@ -386,6 +392,7 @@ public class Sketchbook {
if (addLibraries(importMenu, examplesFolder)) {
importMenu.addSeparator();
}
addLibraries(importMenu, userLibrariesFolder);
addLibraries(importMenu, librariesFolder);
//System.out.println("libraries cp is now " + librariesClassPath);