diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-06-30 09:52:39 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2007-06-30 09:52:39 +0000 |
| commit | e36a3de0f458a9267f4d4907e78e706400b7a18c (patch) | |
| tree | 2802fa3d5bf59eed3e07368764a18904b11f05ab /src/File.cc | |
| parent | 50b4cf67e04f4253891c53c1b1b97168fdc1aa76 (diff) | |
2007-06-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Made -S option work with metalink file and provided selective
download
to metalink.
* src/MetalinkEntry.h, src/MetalinkEntry.cc
(filename): Removed.
(file): New variable.
(size): Removed.
(operator=): Updated.
(getPath): New function.
(getLength): New function.
(toFileEntry): New function.
* src/TorrentRequestInfo.h, src/TorrentRequestInfo.cc
(execute): Use toStream.
(showFileEntry): Removed.
* src/MetalinkRequestInfo.h
(targetFiles): New variable.
(setTargetFiles): New variable.
* src/MetalinkRequestInfo.cc
(execute): Added the ability to print file information included
in
a metalink file.
Added selective download mode to metalink.
* src/main.cc
(showUsage): Updated to denote that -S and --select-file options
are
applicable to metalink.
* src/FileEntry.h
(operator=): New function.
(getBasename): New function.
(getDirname): New function.
* src/Util.h, src/Util.cc
(toStream): New function.
* src/Xml2MetalinkProcessor.cc: Updated.
Made aria2 work with metalink with directory structure.
* src/File.h, src/File.cc
(getBasename): New function.
(getDirname): New function.
* src/RequestGroup.h, src/RequestGroup.cc
(_topDir): New variable.
(setTopDir): New function.
(initSegmentMan): A directory structure is added to
_segmentMan->dir.
Rewrote HTTP header parsing with stringstream.
* src/HttpConnection.h, src/HttpConnection.cc
(HttpRequestEntry): New class.
(headerBuf): Removed.
(headerBufLength): Removed.
(outstandingHttpRequests): Now its element type is
HttpRequestEntryHandle.
(findEndOfHeader): Removed.
(receiveResponse): Rewritten.
Updated doc for -j option to notice that it should be used with
-i
option.
* src/main.cc (showUsage)
Removed unused classes.
* src/RequestInfo.h
(FileInfo): Removed.
(checksum): Removed.
(fileInfo): Removed.
(setChecksum): Removed.
(getChecksum): Removed.
(getFileInfo): Removed.
Use ISO units.
* src/ConsoleDownloadEngine.cc
* src/TorrentConsoleDownloadEngine.cc
* src/Util.cc (abbrevSize)
Diffstat (limited to 'src/File.cc')
| -rw-r--r-- | src/File.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/File.cc b/src/File.cc index 7ddc71a2..0d55a250 100644 --- a/src/File.cc +++ b/src/File.cc @@ -37,6 +37,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> +#include <libgen.h> File::File(const string& name):name(name) {} @@ -120,3 +121,19 @@ mode_t File::mode() } return fstat.st_mode; } + +string File::getBasename() const +{ + char* s = strdup(name.c_str()); + string bname = basename(s); + free(s); + return bname; +} + +string File::getDirname() const +{ + char* s = strdup(name.c_str()); + string dname = dirname(s); + free(s); + return dname; +} |
