46 if ((buf[len-1] ==
'/')
47 || (buf[len-1] ==
'\\'))
66 p =
"installmgr@user.com";
94 SWLOGD(
"RemoteTransport::getDirList(%s)", dirURL);
95 vector<struct DirEntry> dirList;
98 if (!
getURL(
"", dirURL, &dirBuf)) {
104 for (end = start; *end; end++) {
106 if ((*end == 10) || (*end == 13)) {
111 else if ((*end != 10) && (*end != 13))
114 SWLOGD(
"getDirList: parsing item %s(%d)\n", start, end-start);
115 int status =
ftpparse(&item, start, (
int)(end - start));
120 if (status && name !=
"." && name !=
"..") {
125 dirList.push_back(i);
141 SWLOGD(
"RemoteTransport::copyDirectory");
148 SWLOGD(
"NetTransport: getting dir %s\n", url.
c_str());
151 if (!dirList.size()) {
160 if (i == dirList.size())
167 vector<struct DirEntry> sd =
getDirList((url + name +
'/').c_str());
168 for (
unsigned int ii = 0; ii < sd.size(); ii++) {
169 sd[ii].name = name +
'/' + sd[ii].name;
170 dirList.push_back(sd[ii]);
172 dirList.erase(dirList.begin() + i);
175 totalBytes += e.
size;
180 long completedBytes = 0;
181 for (i = 0; i < dirList.size(); i++) {
182 struct DirEntry &dirEntry = dirList[i];
186 buffer += dirEntry.
name;
187 if (!strcmp(&buffer.
c_str()[buffer.
length()-strlen(suffix)], suffix)) {
188 SWBuf buffer2 =
"Downloading (";
193 buffer2 += dirEntry.
name;
201 url += dirEntry.
name;
207 completedBytes += dirEntry.
size;
220 #if defined(__GNUC__)
221 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#define SWORD_NAMESPACE_START
SWBuf & appendFormatted(const char *format,...)
unsigned long length() const
static SWLog * getSystemLog()
virtual char getURL(const char *destPath, const char *sourceURL, SWBuf *destBuf=0)
StatusReporter * statusReporter
const char * c_str() const
SWBuf & append(const char *str, long max=-1)
virtual void preStatus(long totalBytes, long completedBytes, const char *message)
virtual char putURL(const char *destURL, const char *sourcePath, SWBuf *sourceBuf=0)
int copyDirectory(const char *urlPrefix, const char *dir, const char *dest, const char *suffix)
static void removeTrailingSlash(SWBuf &buf)
RemoteTransport(const char *host, StatusReporter *statusReporter=0)
static int createParent(const char *pName)
unsigned long size() const
virtual void update(unsigned long totalBytes, unsigned long completedBytes)
void logWarning(const char *fmt,...) const
virtual std::vector< struct DirEntry > getDirList(const char *dirURL)
bool unverifiedPeerAllowed
virtual SWDEPRECATED void statusUpdate(double dtTotal, double dlNow)
int ftpparse(struct ftpparse *fp, char *buf, int len)
#define SWORD_NAMESPACE_END
virtual ~RemoteTransport()
StatusReporter * statusReporter