mirror of https://github.com/aria2/aria2
2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Slice/joinPath for name of single torrent. * src/DefaultBtContext.cc * test/DefaultBtContextTest.ccpull/1/head
parent
b721f2e192
commit
c211a2aa4c
|
@ -1,3 +1,9 @@
|
|||
2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Slice/joinPath for name of single torrent.
|
||||
* src/DefaultBtContext.cc
|
||||
* test/DefaultBtContextTest.cc
|
||||
|
||||
2009-03-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Updated man page: Documented --dry-run and --index-out
|
||||
|
|
|
@ -181,8 +181,13 @@ void DefaultBtContext::extractFileEntries(const bencode::BDE& infoDict,
|
|||
BtContext::C_LENGTH.c_str()).str());
|
||||
}
|
||||
totalLength = lengthData.i();
|
||||
// TODO slice name and apply Util::joinPath()
|
||||
FileEntryHandle fileEntry(new FileEntry(_dir+"/"+name, totalLength, 0, urlList));
|
||||
// Slice path by '/' just in case nasty ".." is included in name
|
||||
std::deque<std::string> pathelems;
|
||||
Util::slice(pathelems, name, '/');
|
||||
pathelems.push_front(_dir);
|
||||
SharedHandle<FileEntry> fileEntry
|
||||
(new FileEntry(Util::joinPath(pathelems.begin(), pathelems.end()),
|
||||
totalLength, 0, urlList));
|
||||
fileEntries.push_back(fileEntry);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ void DefaultBtContextTest::testGetFileEntriesSingle() {
|
|||
std::deque<SharedHandle<FileEntry> >::iterator itr = fileEntries.begin();
|
||||
|
||||
SharedHandle<FileEntry> fileEntry1 = *itr;
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("./aria2-0.8.2.tar.bz2"),
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("aria2-0.8.2.tar.bz2"),
|
||||
fileEntry1->getPath());
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ void DefaultBtContextTest::testGetFileEntries_singleFileUrlList() {
|
|||
CPPUNIT_ASSERT_EQUAL((size_t)1, fileEntries.size());
|
||||
|
||||
SharedHandle<FileEntry> fileEntry1 = fileEntries.front();
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("./aria2.tar.bz2"),
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("aria2.tar.bz2"),
|
||||
fileEntry1->getPath());
|
||||
std::deque<std::string> uris1 = fileEntry1->getAssociatedUris();
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, uris1.size());
|
||||
|
|
Loading…
Reference in New Issue