[jsword-devel] Module Installation
Troy A. Griffitts
jsword-devel@crosswire.org
Wed, 04 Feb 2004 18:42:58 -0700
Sorry Joe,
The import lines are:
entry = module->second.find("DataPath");
if (entry != module->second.end()) {
SWBuf modDir = entry->second.c_str();
entry = module->second.find("ModDrv");
if (entry != module->second.end()) {
if (!strcmp(entry->second.c_str(), "RawLD") ||
!strcmp(entry->second.c_str(), "RawLD4") ||
!strcmp(entry->second.c_str(), "zLD") || !strcmp(entry->second.c_str(),
"RawGenBook") || !strcmp(entry->second.c_str(), "zGenBook")) {
// strip the last '/*'
Basically this says:
Read the datapath and moddrv entries
If (the moddrv is one in the list above) {
then strip off from datapath the trailing '/whatever'
use the datapath
Hope this helps.
Basically, datapath is either a directory or a directory/fileprefix.
The moddrv type above use directory/fileprefix and need the /fileprefix
removed to get the directory.
Chris is also right. You should recurse into subdirectories. We
support images and these are usually grouped into an image subdirectory.
Our installmgr code does not yet do this but it is on our todo list :)
-Troy.
Joe Walker wrote:
>
> Hi,
>
> I got an answer to the module installation problem on sword-devel, now I
> just need to understand it!
>
> I know from the mail below what the c++ code does to download modules,
> but I don't know c++ so I'm struggling. Can anyone help?
>
> I was trying to understand where AbsoluteDataPath comes from and I came
> across this line:
>
> for (; ((*buf2) && ((*buf2 == '.') || (*buf2 == '/') || (*buf2 ==
> '\\'))); buf2++);
>
> And my brain crashed.
> I don't know perl either, but I'm betting that that line is also valid
> in perl, however in perl it is a complete implementation of the game of
> life or something.
>
> It's probably not worth spending ages over because I reckon it must be
> possible to go from the module type + module name, but I any of you
> speak c++ like a native and could tell me from these sources, what to
> download I'd be grateful.
>
> ftp://ftp.crosswire.org/pub/sword/source/v1.5/sword-1.5.7/src/mgr/installmgr.cpp
>
> ftp://ftp.crosswire.org/pub/sword/source/v1.5/sword-1.5.7/src/mgr/swmgr.cpp
>
> Thanks,
>
> Joe.
>
> -------- Original Message --------
> Subject: Re: [sword-devel] Module Installation
> From: Troy A. Griffitts <scribe@crosswire.org>
> To: sword-devel@crosswire.org
>
> Hey Joe,
> Yeah, we have an attribute stored for a module called: AbsoluteDataPath
> which will return the directory the fullpath to the datafiles. It's
> built in SWMgr. There is duplicate code in src/mgr/installmgr.cpp that
> does the same thing (which should be removed and used AbsoluteDataPath,
> but give the algorithm more concisely).
>
> Hope this helps,
> -Troy.
>
> cf. /RawGenBook
> ftp://ftp.crosswire.org/pub/sword/source/v1.5/sword-1.5.7/src/mgr/installmgr.cpp
>
>
> cf. /AbsoluteDataPath
> ftp://ftp.crosswire.org/pub/sword/source/v1.5/sword-1.5.7/src/mgr/swmgr.cpp
>
>
>
>
> Joe Walker wrote:
>
>>
>> Hi,
>>
>> I'm adding a module downloader to JSword, and not being totally sure
>> how to get it to work.
>>
>> The current algorithm goes like this:
>>
>> - download "mods.d.tar.gz" from the given directory
>> - unpack, and select a module
>> - from the config file for a module pick the DataPath element
>> - download all the files from that directory (without recursing
>> down the tree) into a directory of the same name within your
>> sword modules tree.
>>
>> However this fails because many of the DataPath elements point off
>> into space somewhere.
>>
>> Does anyone know the right algorithm?
>>
>> Thanks,
>>
>> Joe.
>>
>>
>> _______________________________________________
>> sword-devel mailing list
>> sword-devel@crosswire.org
>> http://www.crosswire.org/mailman/listinfo/sword-devel
>
>
> _______________________________________________
> sword-devel mailing list
> sword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/sword-devel
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel