2009-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Use Util::pathJoin()
	* src/DefaultBtContext.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-03-04 15:55:16 +00:00
parent 70a8403575
commit 27ff58c06e
2 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,8 @@
2009-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use Util::pathJoin()
* src/DefaultBtContext.cc
2009-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2009-03-05 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added Util::pathJoin() Added Util::pathJoin()

View File

@ -38,6 +38,7 @@
#include <ostream> #include <ostream>
#include <functional> #include <functional>
#include <algorithm> #include <algorithm>
#include <vector>
#include "DlAbortEx.h" #include "DlAbortEx.h"
#include "Util.h" #include "Util.h"
@ -149,12 +150,11 @@ void DefaultBtContext::extractFileEntries(const bencode::BDE& infoDict,
if(!pathList.isList() || pathList.empty()) { if(!pathList.isList() || pathList.empty()) {
throw DlAbortEx("Path is empty."); throw DlAbortEx("Path is empty.");
} }
std::string path;
for(size_t i = 0; i < pathList.size()-1; ++i) { std::vector<std::string> elements(pathList.size());
path += pathList[i].s()+"/"; std::transform(pathList.listBegin(), pathList.listEnd(), elements.begin(),
std::mem_fun_ref(&bencode::BDE::s));
} std::string path = Util::joinPath(elements.begin(), elements.end());
path += pathList[pathList.size()-1].s();
std::deque<std::string> uris; std::deque<std::string> uris;
std::transform(urlList.begin(), urlList.end(), std::back_inserter(uris), std::transform(urlList.begin(), urlList.end(), std::back_inserter(uris),