[bt-devel] win32 binary - sword path issue (crash)
Eeli Kaikkonen
eekaikko at mail.student.oulu.fi
Wed Apr 15 12:45:07 MST 2009
Martin Zibricky wrote:
> I've used SWORD_PATH.
>
> Now I'm getting only ASSERT msg:
> (BibleTime 2.0.alpha2) _FATAL_: ASSERT: "sourceList.count() > 0" in file
> c:\bt\bibletime-svn\src\frontend\bookshelfmanager\installpage
> \btsourcewidget.cpp, line
> 225
This is our code:
QStringList sourceList = instbackend::sourceList();
...
if (!sourceList.count()) {
sword::InstallSource is("FTP"); //default return value
is.caption = "Crosswire";
is.source = "ftp.crosswire.org";
is.directory = "/pub/sword/raw";
// passive ftp is not needed here, it's the default
instbackend::addSource(is);
sourceList = instbackend::sourceList();
Q_ASSERT( sourceList.count() > 0 );
}
If there are no sources defined in the SWORD library, BibleTime adds the
CrossWire repository. After that the library should return a list with
one source. Probably there's still something wrong with the SWORD
installation - or there's something changed in the library and we use it
wrong. Here's more code, if someone happens to be able to help (these
are from instbackend:: namespace, BtInstallMgr inherits the sword instmgr):
bool addSource(sword::InstallSource& source)
{
qDebug("backend::addSource");
SWConfig config(configFilename().toLatin1());
if (!strcmp(source.type, "FTP")) {
//make sure the path doesn't have a trailing slash, sword doesn't like it
if (source.directory[ source.directory.length()-1 ] == '/') {
source.directory--; //make one char shorter
}
config["Sources"].insert( std::make_pair(SWBuf("FTPSource"),
source.getConfEnt()) );
}
else if (!strcmp(source.type, "DIR")) {
config["Sources"].insert( std::make_pair(SWBuf("DIRSource"),
source.getConfEnt()) );
}
config.Save();
return true;
}
QStringList sourceList()
{
qDebug("backend::sourceList");
BtInstallMgr mgr;
Q_ASSERT(mgr.installConf);
QStringList names;
//add Sword remote sources
for (InstallSourceMap::iterator it = mgr.sources.begin(); it !=
mgr.sources.end(); it++) {
names << QString::fromLocal8Bit(it->second->caption);
}
// Add local directory sources
SWConfig config(configFilename().toLatin1());
sword::SectionMap::iterator sourcesSection =
config.Sections.find("Sources");
if (sourcesSection != config.Sections.end()) {
sword::ConfigEntMap::iterator sourceBegin =
sourcesSection->second.lower_bound("DIRSource");
sword::ConfigEntMap::iterator sourceEnd =
sourcesSection->second.upper_bound("DIRSource");
while (sourceBegin != sourceEnd) {
InstallSource is("DIR", sourceBegin->second.c_str());
names << QString::fromLatin1(is.caption.c_str());
sourceBegin++;
}
}
return names;
}
More information about the bt-devel
mailing list