[sword-devel] module configuration problem: lack of trailing slash

Karl Kleinpaste karl at kleinpaste.org
Wed Jul 11 18:00:04 MST 2012


Execute this vulgar pipeline in your .sword/mods.d directory:

grep -l DataPath.*texts * | xargs grep ^DataPath | tr -d '\r' | grep -v /$ | cut -f1 -d: | xargs grep '^\[' | cut -f2 -d: | tr -d '[]\r'

What that finds is the set of Bible modules whose DataPath line does not
end in a trailing '/'.  I find 50 of them, 45 of which are Wycliffe's.

This is a problem because of the desire in Xiphos to be able to archive
a module, using libgsf to create a *.zip.  The trouble comes from the
fact that, for some classes of modules, like lexdicts, DataPath ends in
a root filename onto which extensions are added, so in order to get a
directory name for the whole content of the module, we strip back to the
last '/' and hand that dirname to libgsf to archive.  For example,
        DataPath=./modules/lexdict/rawld4/strongsrealgreek/strongsrealgreek
is reduced for libgsf's purposes to
        ./modules/lexdict/rawld4/strongsrealgreek/
Fine so far.

But now take
        DataPath=./modules/texts/ztext/somkqa
and realize what this necessarily naive reduction operation does to us:

We archive all texts under the ztext dir.

/oops/

I have no method by which to determine whether the supplied DataPath
directory is proper as it stands or must be stripped of its last
element, other than the presence of the trailing '/'.

By far (295 Bible modules, a 6:1 ratio), most modules do include the
trailing '/'.  Does our configuration standard require the trailing '/',
or is its majority presence a mere habit?

I'd like to agitate that trailing '/' be mandatory for modules other
than lexdicts and genbooks which don't end in that root filename, but I
don't yet perceive whether that's a reasonable demand.



More information about the sword-devel mailing list