[sword-cvs] sword/src/mgr installmgr.cpp,1.15,1.16
sword@www.crosswire.org
sword@www.crosswire.org
Tue, 25 Nov 2003 12:11:15 -0700
Update of /usr/local/cvsroot/sword/src/mgr
In directory www:/tmp/cvs-serv28029/src/mgr
Modified Files:
installmgr.cpp
Log Message:
fixes for trailing problem and curl (bibles were not installed with trailing slash on the url; cleanup to remove file part code) [jansorg]
Index: installmgr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/mgr/installmgr.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- installmgr.cpp 15 Aug 2003 08:52:15 -0000 1.15
+++ installmgr.cpp 25 Nov 2003 19:11:13 -0000 1.16
@@ -468,28 +468,27 @@
}
else { //copy all files in DataPath directory
ConfigEntMap::iterator entry;
- SWBuf modDir;
SWBuf sourceOrig = sourceDir;
entry = module->second.find("DataPath");
if (entry != module->second.end()) {
- modDir = entry->second.c_str();
+ 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")) {
- char *buf = new char [ strlen(modDir.c_str()) + 1 ];
-
- strcpy(buf, modDir.c_str());
- int end = strlen(buf) - 1;
- while (end) {
- if (buf[end] == '/')
+ int end = modDir.length() - 1;
+ while (end >= 0) { //while(end) wouldn't work for length() == 0
+ if (modDir[end] == '/')
break;
+
+ modDir--; //remove last char
end--;
}
- buf[end] = 0;
- modDir = buf;
- delete [] buf;
}
+
+ //make sure there's no trailing slash in modDir, required for Bibles and Commentaries
+ if ( modDir.length() && (modDir[modDir.length()-1] == '/')) //last char is a slash
+ modDir--; //remove the slash
}
if (is) {