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

Use Util::pathJoin()
	* src/MetalinkParserController.cc
	* test/test.xml
pull/1/head
Tatsuhiro Tsujikawa 2009-03-04 15:56:56 +00:00
parent 27ff58c06e
commit 4aae48c9b2
3 changed files with 17 additions and 4 deletions

View File

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

View File

@ -33,6 +33,9 @@
*/ */
/* copyright --> */ /* copyright --> */
#include "MetalinkParserController.h" #include "MetalinkParserController.h"
#include <algorithm>
#include "Metalinker.h" #include "Metalinker.h"
#include "MetalinkEntry.h" #include "MetalinkEntry.h"
#include "MetalinkResource.h" #include "MetalinkResource.h"
@ -45,7 +48,7 @@
# include "messageDigest.h" # include "messageDigest.h"
#endif // ENABLE_MESSAGE_DIGEST #endif // ENABLE_MESSAGE_DIGEST
#include "Signature.h" #include "Signature.h"
#include <algorithm> #include "Util.h"
namespace aria2 { namespace aria2 {
@ -77,10 +80,14 @@ void MetalinkParserController::setFileNameOfEntry(const std::string& filename)
if(_tEntry.isNull()) { if(_tEntry.isNull()) {
return; return;
} }
std::deque<std::string> elements;
Util::slice(elements, filename, '/');
std::string path = Util::joinPath(elements.begin(), elements.end());
if(_tEntry->file.isNull()) { if(_tEntry->file.isNull()) {
_tEntry->file.reset(new FileEntry(filename, 0, 0)); _tEntry->file.reset(new FileEntry(path, 0, 0));
} else { } else {
_tEntry->file->setPath(filename); _tEntry->file->setPath(path);
} }
} }

View File

@ -28,7 +28,7 @@ fffff
<url type="http" location="us" preference="100">http://httphost/aria2-0.5.2.tar.bz2</url> <url type="http" location="us" preference="100">http://httphost/aria2-0.5.2.tar.bz2</url>
</resources> </resources>
</file> </file>
<file name="aria2-0.5.1.tar.bz2"> <file name="dir/../aria2-0.5.1.tar.bz2">
<size>345689</size> <size>345689</size>
<version>0.5.1</version> <version>0.5.1</version>
<language>ja-JP</language> <language>ja-JP</language>