[sword-svn] r83 - trunk/app/src/org/crosswire/flashcards
Apache
apache at crosswire.org
Mon Nov 15 01:43:34 MST 2004
Author:
Date: 2004-11-15 01:43:33 -0700 (Mon, 15 Nov 2004)
New Revision: 83
Modified:
trunk/app/src/org/crosswire/flashcards/LessonManager.java
Log:
Added a new search path for lessons: directory which contains flashcards.jar
Modified: trunk/app/src/org/crosswire/flashcards/LessonManager.java
===================================================================
--- trunk/app/src/org/crosswire/flashcards/LessonManager.java 2004-11-14 22:00:35 UTC (rev 82)
+++ trunk/app/src/org/crosswire/flashcards/LessonManager.java 2004-11-15 08:43:33 UTC (rev 83)
@@ -108,12 +108,34 @@
* Load this lesson from persistent store named by the lesson's <code>LESSON_ROOT</code>.
*/
public void load() {
- // see if there are any jars in our home directory with lesson sets
+ // see if there are any jars in our CWD with lesson sets
loadLessonSetsFromJarDir("./");
+
// see if there are any lesson sets in our home project dir
loadLessonSetsFromDir(homeLessonDir);
+
+ // find the directory containing this
+ // search all jars in that directory for lesson sets
+ String thisName = this.getClass().getName();
+ String thisRes = "/" + thisName.replace('.', '/') + ".class";
+ URL thisURL = this.getClass().getResource(thisRes);
+ if (thisURL == null) {
+ return;
+ }
+ URLConnection thisCon = null;
+ try {
+ thisCon = thisURL.openConnection();
+ }
+ catch (Exception e1) {
+ assert false;
+ }
+ if (thisCon instanceof JarURLConnection) {
+ JarURLConnection jarConnection = (JarURLConnection) thisCon;
+ loadLessonSetsFromJarDir(new File(jarConnection.getJarFileURL().getFile()).getParent());
+ }
+
// see if there are any lessons on our path
- // Dig into the jar for lessonSets
+ // dig into the jar for lessonSets
URL lessonsURL = this.getClass().getResource('/' + LESSON_ROOT);
if (lessonsURL == null) {
return;
@@ -142,6 +164,9 @@
catch (Exception e) { e.printStackTrace(); }
}
+
+
+
}
More information about the sword-cvs
mailing list