[jsword-devel] BibleDesktop and Persistent window positioning

DM Smith dmsmith555 at yahoo.com
Sat Jul 26 09:29:47 MST 2008


On Jul 26, 2008, at 11:50 AM, Neil Short wrote:

> My question of the day is this:
> Where is this file LayoutPersistence.properties ?
> If you simply specify a location thin your code will not be cross- 
> platform. If you  use the function System.getProperty("user.home")  
> then your code WILL be cross-platform.

The location is cross-platform but acknowledges that Windows and Mac  
like to do it differently.

JSword starts out with System.getProperty("jsword.home"). If this is  
defined then we are done.

Likewise, if System.getProperty("sword.home") is defined, it will use  
that as the default module home.

On all other platforms, the location starts with  
System.getProperty("user.home"), or what I'll shorthand, *nix style,  
to be ~.

Then jsword.home is determined to be on non-mac/non-windows to be  
~/.jsword and sword.home will be ~/.sword.

On the Mac jsword.home is set to ~/Library/Application Support/JSword  
and sword.home to ~/Library/Application Support/Sword.

On Windows, we use:
jsword.home => ~/Application Data/JSword
sword.home => ~/Application Data/Sword

We use a custom classloader that prepends jsword.home to the  
classpath. That way any resource that is embedded in the jars can be  
found in jsword.home. The resource can be pathed, prefixed or simply  
named, that is:
Pathed	=> org/crosswire/common/util/LayoutPersistence.properties
Prefixed => org.crosswire.common.util.LayoutPersistence.properties
Simple	=> LayoutPersistence.properties

Hope that helps,
	DM






More information about the jsword-devel mailing list