[sword-devel] New website - installation instructions

DM Smith dmsmith555 at yahoo.com
Fri Dec 19 16:00:09 MST 2008


Tonny Kohar wrote:
> Hi,
>
> On Sat, Dec 20, 2008 at 2:41 AM, Tonny Kohar <tonny.kohar at gmail.com> wrote:
>   
>> Hi,
>>
>>
>> On Fri, Dec 19, 2008 at 9:06 PM, DM Smith <dmsmith555 at yahoo.com> wrote:
>>     
>>> Both MacSword and JSword will set the install location to
>>> ~/Library/Application Support/Sword.
>>>       
>> Just quick questions, is that Mac OSX location (~/Library/Application
>> Support/Sword) is mapped into env variable which is accesssible/able
>> to get the value from System.getProperties (java program) ? or it must
>> be hard coded ?
>>     
>
> Almost forgot, Does the mentioned path above is in English
> (~/Library/Application/Support/Sword) ?
> Does Mac OSX allow folder path to be put using other language eg:
> chinese/japanese/etc.
>
> ps: Windows allows folder and file path/name using other language.
>   
Tonny,

I didn't know about the alternate languages for Windows. No one has 
reported a problem yet. My hope is that Windows uses "Application Data" 
regardless of language, as this folder is created by the OS.

The code JSword uses is here:
http://crosswire.org/svn/jsword/trunk/common/src/main/java/org/crosswire/common/util/OSType.java

A couple of things:
1) The java property os.name is used to determine the kind of OS. 
OSType.fromString(System.getProperty("os.name")) will figure out what 
the OS is.
2) The static OSType.getOSType() will return the proper OSType for the 
machine.
3) Given the proper OSType for the machine, the method:
getUserAreaFolder(".sword", "Sword")
will return a complete path to the appropriately named folder in the 
OSes app data area for the user.
4) the path is based upon the Java property user.home, which can be 
changed via -Duser.home=/somewhere/else. This is very useful.

It is typically called in this fashion:
URI appDataArea = OSType.getOSType().getUserAreaFolder(".jsword", "JSword");
For my home computer, this evaluates to 
"file:///Users/DM/Library/Application Support/JSword"
On windows, I get something like "file:///c:/Documents and 
Settings/dm/Application Data/JSword".
Elsewhere (Linux, BSD, ...), I get "file:///home/dmsmith/.jsword".
(I might have too many or few /// in file:/// :)

There are a couple of places that Mac specific behavior needs to be 
added (e.g. placing preferences on the proper menu) so the following 
construct can be used:
if (OSType.MAC.equals(OSType.getOSType()))
{
.... do something Mac specific ...
}

In Him,
    DM




More information about the sword-devel mailing list