[jsword-svn] r1694 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop common-swing/src/main/java/org/crosswire/common/swing jsword/src/main/java/org/crosswire/jsword/book/sword
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Tue Aug 28 04:21:37 MST 2007
Author: dmsmith
Date: 2007-08-28 04:21:36 -0700 (Tue, 28 Aug 2007)
New Revision: 1694
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookFont.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Translations.java
trunk/common-swing/src/main/java/org/crosswire/common/swing/FontStore.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookPath.java
Log:
fixed a few Portable BibleDesktop problems.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookFont.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookFont.java 2007-08-27 01:00:36 UTC (rev 1693)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookFont.java 2007-08-28 11:21:36 UTC (rev 1694)
@@ -47,7 +47,7 @@
*/
private BookFont()
{
- super("BookFonts", Project.instance().getWritablePropertiesURI("BookFonts")); //$NON-NLS-1$ //$NON-NLS-2$
+ super("BookFonts", Project.instance().getWritableProjectDir()); //$NON-NLS-1$
}
public static BookFont instance()
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Translations.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Translations.java 2007-08-27 01:00:36 UTC (rev 1693)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Translations.java 2007-08-28 11:21:36 UTC (rev 1694)
@@ -32,6 +32,7 @@
import org.crosswire.common.util.Languages;
import org.crosswire.common.util.Logger;
import org.crosswire.common.util.NetUtil;
+import org.crosswire.common.util.ResourceUtil;
import org.crosswire.jsword.util.Project;
/**
@@ -50,8 +51,7 @@
{
try
{
- URI inputURI = Project.instance().getWritablePropertiesURI(getClass().getName());
- Properties props = NetUtil.loadProperties(inputURI);
+ Properties props = ResourceUtil.getProperties(getClass().getName());
translation = props.getProperty(TRANSLATION_KEY, DEFAULT_TRANSLATION);
}
catch (IOException e)
Modified: trunk/common-swing/src/main/java/org/crosswire/common/swing/FontStore.java
===================================================================
--- trunk/common-swing/src/main/java/org/crosswire/common/swing/FontStore.java 2007-08-27 01:00:36 UTC (rev 1693)
+++ trunk/common-swing/src/main/java/org/crosswire/common/swing/FontStore.java 2007-08-28 11:21:36 UTC (rev 1694)
@@ -26,9 +26,11 @@
import java.net.URI;
import java.util.Properties;
+import org.crosswire.common.util.FileUtil;
import org.crosswire.common.util.Language;
import org.crosswire.common.util.Logger;
import org.crosswire.common.util.NetUtil;
+import org.crosswire.common.util.ResourceUtil;
/**
* Font Store maintains a persistent, hierarchical store of user font preferences. A font
@@ -64,18 +66,19 @@
/**
* Create an new FontStore with the given persistent store.
*
- * @param storeName The name of the store, used as a label inside the
+ * @param storeName The name of the store, used as a file name and as a label inside the
* fontStore.
- * @param fontStore The location of the resource.
+ * @param fontStore The name of the properties file.
+ * @param fontDir The location where the fontStore can be stored.
*/
- public FontStore(String storeName, URI fontStore)
+ public FontStore(String storeName, URI fontDir)
{
- if (fontStore == null)
+ if (fontDir == null)
{
throw new IllegalArgumentException("fontStore cannot be null"); //$NON-NLS-1$
}
this.storeName = storeName;
- this.fontStore = fontStore;
+ this.fontStore = NetUtil.lengthenURI(fontDir, this.storeName + FileUtil.EXTENSION_PROPERTIES);
this.fontMap = new Properties();
}
@@ -205,7 +208,7 @@
try
{
- fontMap = NetUtil.loadProperties(fontStore);
+ fontMap = ResourceUtil.getProperties(storeName);
loaded = true;
}
catch (IOException e)
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookPath.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookPath.java 2007-08-27 01:00:36 UTC (rev 1693)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/sword/SwordBookPath.java 2007-08-28 11:21:36 UTC (rev 1694)
@@ -56,8 +56,8 @@
}
/**
- * Accessor for the Sword directory
- * @param theNewDirs The new Sword directory
+ * Establish additional locations that Sword may hold books.
+ * @param theNewDirs The new Sword directories
* @throws BookException
*/
public static void setAugmentPath(File[] theNewDirs) throws BookException
@@ -75,7 +75,7 @@
}
/**
- * Accessor for the Sword directory
+ * Retrieve the additional locations that Sword may hold Books.
* @return The new Sword directory
*/
public static File[] getAugmentPath()
@@ -128,6 +128,11 @@
return (File[]) swordPath.toArray(new File[swordPath.size()]);
}
+ /**
+ * Get a list of books in a given location.
+ * @param bookDir the directory in which to look
+ * @return the list of books in that location
+ */
public static String[] getBookList(File bookDir)
{
return bookDir.list(new CustomFilenameFilter());
@@ -146,7 +151,7 @@
String home = System.getProperty(PROPERTY_USER_HOME);
- // Is sword.conf in the current diretory?
+ // Is sword.conf in the current directory?
readSwordConf(bookDirs, "."); //$NON-NLS-1$
// mods.d in the current directory?
@@ -156,6 +161,7 @@
testDefaultPath(bookDirs, ".." + File.separator + DIR_SWORD_LIBRARY); //$NON-NLS-1$
// if there is a property set for the sword home directory
+ // The Sword project defines SWORD_HOME, but JSword expects this to be transformed into sword.home.
String swordhome = System.getProperty(PROPERTY_SWORD_HOME);
if (swordhome != null)
{
@@ -187,6 +193,8 @@
// Check look for mods.d in the sword user data area
testDefaultPath(bookDirs, new File(userDataArea.getPath()));
+ // JSword used to hold books in ~/.jsword (or its equivalent) but has code that will
+ // migrate it to ~/.sword (or its equivalent)
// If the migration did not work then use the old area
testDefaultPath(bookDirs, new File(Project.instance().getWritableProjectDir().getPath()));
More information about the jsword-svn
mailing list