[sword-cvs] sword/src/mgr installmgr.cpp,1.9,1.10
sword@www.crosswire.org
sword@www.crosswire.org
Mon, 7 Jul 2003 07:16:27 -0700
Update of /usr/local/cvsroot/sword/src/mgr
In directory www:/tmp/cvs-serv15875/src/mgr
Modified Files:
installmgr.cpp
Log Message:
Added InstallMgr basic feature for remote source installation
Index: installmgr.cpp
===================================================================
RCS file: /usr/local/cvsroot/sword/src/mgr/installmgr.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** installmgr.cpp 7 Jul 2003 02:50:05 -0000 1.9
--- installmgr.cpp 7 Jul 2003 14:16:25 -0000 1.10
***************
*** 6,12 ****
- // stupid hack to make untgz stuff compile
- #define VCL
-
extern "C" {
#include <untgz.h>
--- 6,9 ----
***************
*** 104,108 ****
while (sourceBegin != sourceEnd) {
! InstallSource *is = new InstallSource(sourceBegin->second.c_str(), "FTP");
sources[is->caption] = is;
SWBuf parent = (SWBuf)privatePath + "/" + is->source + "/file";
--- 101,105 ----
while (sourceBegin != sourceEnd) {
! InstallSource *is = new InstallSource("FTP", sourceBegin->second.c_str());
sources[is->caption] = is;
SWBuf parent = (SWBuf)privatePath + "/" + is->source + "/file";
***************
*** 297,311 ****
! InstallSource::InstallSource(const char *confEnt, const char *type) {
! char *buf = 0;
! stdstr(&buf, confEnt);
!
! caption = strtok(buf, "|");
! source = strtok(0, "|");
! directory = strtok(0, "|");
! delete [] buf;
this->type = type;
mgr = 0;
userData = 0;
}
--- 294,310 ----
! InstallSource::InstallSource(const char *type, const char *confEnt) {
this->type = type;
mgr = 0;
userData = 0;
+ if (confEnt) {
+ char *buf = 0;
+ stdstr(&buf, confEnt);
+
+ caption = strtok(buf, "|");
+ source = strtok(0, "|");
+ directory = strtok(0, "|");
+ delete [] buf;
+ }
}
***************
*** 316,319 ****
--- 315,327 ----
}
+
+ void InstallSource::flush() {
+ if (mgr) {
+ delete mgr;
+ mgr = 0;
+ }
+ }
+
+
SWMgr *InstallSource::getMgr() {
if (!mgr)
***************
*** 321,324 ****
--- 329,334 ----
return mgr;
}
+
+
int InstallMgr::FTPCopy(InstallSource *is, const char *src, const char *dest, bool dirTransfer, const char *suffix) {
terminate = false;
***************
*** 382,385 ****
--- 392,396 ----
}
catch(...){}
+ return 0;
}
***************
*** 399,402 ****
--- 410,416 ----
sourceDir = (SWBuf)privatePath + "/" + is->source;
else sourceDir = fromLocation;
+
+ if (sourceDir[sourceDir.length()-1] != '/')
+ sourceDir += '/';
SWMgr mgr(sourceDir.c_str());