summaryrefslogtreecommitdiff
path: root/src/UTMetadataPostDownloadHandler.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-01-11 14:01:20 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-01-11 14:01:20 +0000
commit4c8917048804cbe82febfadcf0b1747ecd888333 (patch)
tree5aa498c2a1613cfc1228f7af5655a5ad0956c8a9 /src/UTMetadataPostDownloadHandler.cc
parent2b62660e4940dbb286dc687fa127f808175c3274 (diff)
2010-01-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Treat --dir="" as --dir="." * src/FtpNegotiationCommand.cc * src/HttpResponseCommand.cc * src/Metalink2RequestGroup.cc * src/UTMetadataPostDownloadHandler.cc * src/bittorrent_helper.cc * src/download_helper.cc * src/util.cc * src/util.h * test/UtilTest.cc
Diffstat (limited to 'src/UTMetadataPostDownloadHandler.cc')
-rw-r--r--src/UTMetadataPostDownloadHandler.cc19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/UTMetadataPostDownloadHandler.cc b/src/UTMetadataPostDownloadHandler.cc
index fd67cf95..d3230ad2 100644
--- a/src/UTMetadataPostDownloadHandler.cc
+++ b/src/UTMetadataPostDownloadHandler.cc
@@ -82,23 +82,22 @@ void UTMetadataPostDownloadHandler::getNextRequestGroups
util::toString(requestGroup->getPieceStorage()->getDiskAdaptor());
std::string torrent = bittorrent::metadata2Torrent(metadata, attrs);
- std::deque<SharedHandle<RequestGroup> > newRgs;
- createRequestGroupForBitTorrent(newRgs, requestGroup->getOption(),
- std::deque<std::string>(), torrent);
- requestGroup->followedBy(newRgs.begin(), newRgs.end());
- groups.insert(groups.end(), newRgs.begin(), newRgs.end());
-
if(requestGroup->getOption()->getAsBool(PREF_BT_SAVE_METADATA)) {
- std::string filename = requestGroup->getOption()->get(PREF_DIR);
- filename += A2STR::SLASH_C;
- filename += util::toHex(attrs[bittorrent::INFO_HASH].s());
- filename += ".torrent";
+ std::string filename =
+ util::applyDir(requestGroup->getOption()->get(PREF_DIR),
+ util::toHex(attrs[bittorrent::INFO_HASH].s())+".torrent");
if(util::saveAs(filename, torrent)) {
_logger->notice(MSG_METADATA_SAVED, filename.c_str());
} else {
_logger->notice(MSG_METADATA_NOT_SAVED, filename.c_str());
}
}
+ std::deque<SharedHandle<RequestGroup> > newRgs;
+ createRequestGroupForBitTorrent(newRgs, requestGroup->getOption(),
+ std::deque<std::string>(), torrent);
+
+ requestGroup->followedBy(newRgs.begin(), newRgs.end());
+ groups.insert(groups.end(), newRgs.begin(), newRgs.end());
}
} // namespace aria2