export applet now working with libs.. also set System.err to work again on

external libs..
This commit is contained in:
benfry
2004-09-22 21:03:10 +00:00
parent 7044875a0c
commit cb2020dd31
2 changed files with 66 additions and 24 deletions

View File

@@ -1145,9 +1145,9 @@ public class PdeSketch {
for (int i = 0; i < imports.length; i++) {
// remove things up to the last dot
String entry = imports[i].substring(0, imports[i].lastIndexOf('.'));
System.out.println("found package " + entry);
//System.out.println("found package " + entry);
Object libFolder = PdeSketchbook.importToLibraryTable.get(entry);
System.out.println(" found lib folder " + libFolder);
//System.out.println(" found lib folder " + libFolder);
importedLibraries.add(libFolder);
}
@@ -1443,6 +1443,48 @@ public class PdeSketch {
packClassPathIntoZipFile(includes, zos);
}
// add contents of 'library' folders to the jar file
// if a file called 'export.txt' is in there, it contains
// a list of the files that should be exported.
// otherwise, all files are exported.
Enumeration enum = importedLibraries.elements();
while (enum.hasMoreElements()) {
// in the list is a File object that points the
// library sketch's "library" folder
File libraryFolder = (File)enum.nextElement();
//System.out.println("exporting files from " + libFolder);
File exportSettings = new File(libraryFolder, "export.txt");
String exportList[]; // = null;
if (exportSettings.exists()) {
exportList = PApplet.loadStrings(exportSettings);
} else {
exportList = libraryFolder.list();
}
for (int i = 0; i < exportList.length; i++) {
if (exportList[i].equals(".") ||
exportList[i].equals("..")) continue;
exportList[i] = PApplet.trim(exportList[i]);
if (exportList[i].equals("")) continue;
File exportFile = new File(libraryFolder, exportList[i]);
if (!exportFile.exists()) {
System.err.println("File " + exportList[i] + " does not exist");
} else if (exportFile.isDirectory()) {
System.err.println("Ignoring sub-folder \"" + exportList[i] + "\"");
} else if (exportFile.getName().toLowerCase().endsWith(".zip") ||
exportFile.getName().toLowerCase().endsWith(".jar")) {
packClassPathIntoZipFile(exportFile.getAbsolutePath(), zos);
} else { // just copy the file over.. prolly a .dll or something
PdeBase.copyFile(exportFile,
new File(appletDir, exportFile.getName()));
}
}
}
// add the appropriate bagel to the classpath
/*
String jdkVersion = PdePreferences.get("compiler.jdk_version");

View File

@@ -85,14 +85,12 @@ X this would avoid having to patch BApplet
X register for setup() calls
X where do libraries for distribution go?
X libraries subfolder of p5
_ PLibrary lib = attach(new PClient());
_ compiling - main file is a .java not a .pde
_ also where no root .pde file with the same name.. (i.e. video)
_ crap.. libraries need to be in packages for this to work
_ but annoying: attach("simong.particlesystem.ParticleSystem")
_ record imports from java files as well
_ ignore imports from java.* or maybe just things pde's classpath
X PLibrary lib = attach(new PClient());
X get export working again
X System.out isn't being heard from P* classes
X errors inside those classes also causing weirdness
X this might be a broader running as external app problem
X errorMessage in PSerial/PClient/PServer are all using System.out
_ be able to link against, but not export, certain parts of lib
_ jsyn.jar not needed on export, netscape libs not needed on export
@@ -100,10 +98,17 @@ _ netscape.javascript not properly working in 1.4
_ include 'netscape.javascript' as a library to be added
_ but don't export it.. ugh..
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1088034754;start=0
library stuff
_ compiling - main file is a .java not a .pde
_ also where no root .pde file with the same name.. (i.e. video)
_ crap.. libraries need to be in packages for this to work
_ but annoying: attach("simong.particlesystem.ParticleSystem")
_ record imports from java files as well
_ ignore imports from java.* or maybe just things pde's classpath
_ after export of library, rebuild "import library" menu
_ should library be called extension?
_ keypressed hanging on applets with a code folder
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1081450102
_ problems running external vm/vm is hanging
@@ -115,19 +120,14 @@ _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1078714442;start=0
_ something in that one about mouse position halting or not
_ get export working again
_ make multiple jar files thing work as an option
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1067360903;start=0
_ applet default is one file, application default is multiple
_ user in advanced mode can switch to the other
_ buttons on side of sketch do default (last) behavior
_ include a note that 'applet' folder will get emptied/rewritten
_ or rename the old applet folder to something else? (nah, too messy)
_ System.out isn't being heard from P* classes
_ errors inside those classes also causing weirdness
_ this might be a broader running as external app problem
_ errorMessage in PSerial/PClient/PServer are all using System.out
export stuff
_ make multiple jar files thing work as an option
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1067360903;start=0
_ applet default is one file, application default is multiple
_ user in advanced mode can switch to the other
_ buttons on side of sketch do default (last) behavior
_ include a note that 'applet' folder will get emptied/rewritten
_ or rename the old applet folder to something else? (nah, too messy)
_ write better handler for compiler error: