[sword-svn] r1706 - in trunk: include src/mgr
jansorg at crosswire.org
jansorg at crosswire.org
Sun Jan 30 13:10:12 MST 2005
Author: jansorg
Date: 2005-01-30 13:10:11 -0700 (Sun, 30 Jan 2005)
New Revision: 1706
Modified:
trunk/include/installmgr.h
trunk/src/mgr/installmgr.cpp
Log:
Some small fixes for the installmgr stuff
Modified: trunk/include/installmgr.h
===================================================================
--- trunk/include/installmgr.h 2005-01-30 01:19:35 UTC (rev 1705)
+++ trunk/include/installmgr.h 2005-01-30 20:10:11 UTC (rev 1706)
@@ -59,7 +59,8 @@
virtual int removeModule(SWMgr *manager, const char *modName);
virtual int ftpCopy(InstallSource *is, const char *src, const char *dest, bool dirTransfer = false, const char *suffix = "");
virtual int installModule(SWMgr *destMgr, const char *fromLocation, const char *modName, InstallSource *is = 0);
- virtual void refreshRemoteSource(InstallSource *is);
+
+ virtual int refreshRemoteSource(InstallSource *is);
virtual bool getCipherCode(const char *modName, SWConfig *config);
void setFTPPassive(bool passive) { this->passive = passive; }
void terminate() { if (transport) transport->terminate(); }
Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp 2005-01-30 01:19:35 UTC (rev 1705)
+++ trunk/src/mgr/installmgr.cpp 2005-01-30 20:10:11 UTC (rev 1706)
@@ -439,10 +439,11 @@
}
-void InstallMgr::refreshRemoteSource(InstallSource *is) {
+int InstallMgr::refreshRemoteSource(InstallSource *is) {
SWBuf root = (SWBuf)privatePath + (SWBuf)"/" + is->source.c_str();
SWBuf target = root + "/mods.d";
-
+ int errorCode = -1; //0 means successful
+
FileMgr::removeDir(target.c_str());
if (!FileMgr::existsDir(target))
@@ -450,15 +451,19 @@
#ifndef EXCLUDEZLIB
SWBuf archive = root + "/mods.d.tar.gz";
- if (!ftpCopy(is, "mods.d.tar.gz", archive.c_str(), false)) {
+
+ errorCode = ftpCopy(is, "mods.d.tar.gz", archive.c_str(), false);
+ if (!errorCode) { //sucessfully downloaded the tar,gz of module configs
int fd = open(archive.c_str(), O_RDONLY|O_BINARY);
untargz(fd, root.c_str());
close(fd);
}
- else
+ else if (!term) //if the tar.gz download was canceled don't continue with another download
#endif
- ftpCopy(is, "mods.d", target.c_str(), true, ".conf");
+ errorCode = ftpCopy(is, "mods.d", target.c_str(), true, ".conf"); //copy the whole directory
+
is->flush();
+ return errorCode;
}
More information about the sword-cvs
mailing list