mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 05:32:31 +00:00
* Set Content::m_chunkSize before adding files.
* Removed the old FileList and replaced it with the cleaned up EntryList code. The API now gives a FileList* instead of FileList. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@810 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <sigc++/signal.h>
|
||||
#include <rak/path.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/file_list.h>
|
||||
#include <torrent/rate.h>
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/tracker.h>
|
||||
@@ -55,7 +56,6 @@ namespace core {
|
||||
|
||||
Download::Download(download_type d) :
|
||||
m_download(d),
|
||||
m_fileList(d.file_list()),
|
||||
m_trackerList(d.tracker_list()),
|
||||
|
||||
m_hashFailed(false),
|
||||
@@ -90,7 +90,7 @@ Download::Download(download_type d) :
|
||||
// resume/pause.
|
||||
m_variables.insert("state_changed", new utils::VariableObject(bencode(), "rtorrent", "state_changed", torrent::Object::TYPE_VALUE));
|
||||
|
||||
m_variables.insert("directory", new utils::VariableStringSlot(rak::mem_fn(&m_fileList, &torrent::FileList::root_dir), rak::mem_fn(this, &Download::set_root_directory)));
|
||||
m_variables.insert("directory", new utils::VariableStringSlot(rak::mem_fn(m_download.file_list(), &torrent::FileList::root_dir), rak::mem_fn(this, &Download::set_root_directory)));
|
||||
|
||||
// m_variables.insert("info_hash", new utils::VariableStringSlot(rak::mem_fn(&m_download, &torrent::Download::info_hash), NULL));
|
||||
|
||||
@@ -250,15 +250,17 @@ Download::receive_chunk_failed(__UNUSED uint32_t idx) {
|
||||
// Clean up.
|
||||
void
|
||||
Download::set_root_directory(const std::string& path) {
|
||||
torrent::FileList* fileList = m_download.file_list();
|
||||
|
||||
if (path.empty()) {
|
||||
m_fileList.set_root_dir("./" + (m_fileList.size() > 1 ? m_download.name() : std::string()));
|
||||
fileList->set_root_dir("./" + (fileList->size_files() > 1 ? m_download.name() : std::string()));
|
||||
|
||||
} else {
|
||||
std::string fullPath = rak::path_expand(path);
|
||||
|
||||
m_fileList.set_root_dir(fullPath +
|
||||
(*fullPath.rbegin() != '/' ? "/" : "") +
|
||||
(m_fileList.size() > 1 ? m_download.name() : ""));
|
||||
fileList->set_root_dir(fullPath +
|
||||
(*fullPath.rbegin() != '/' ? "/" : "") +
|
||||
(fileList->size_files() > 1 ? m_download.name() : ""));
|
||||
}
|
||||
|
||||
bencode()->get_key("rtorrent").insert_key("directory", path);
|
||||
|
||||
+3
-4
@@ -40,7 +40,6 @@
|
||||
#include <rak/string_manip.h>
|
||||
#include <sigc++/connection.h>
|
||||
#include <torrent/download.h>
|
||||
#include <torrent/file_list.h>
|
||||
#include <torrent/hash_string.h>
|
||||
#include <torrent/tracker_list.h>
|
||||
#include <torrent/torrent.h>
|
||||
@@ -52,7 +51,6 @@ namespace core {
|
||||
class Download {
|
||||
public:
|
||||
typedef torrent::Download download_type;
|
||||
typedef torrent::FileList file_list_type;
|
||||
typedef torrent::TrackerList tracker_list_type;
|
||||
typedef download_type::ConnectionType connection_type;
|
||||
typedef utils::VariableMap variable_map_type;
|
||||
@@ -87,8 +85,10 @@ public:
|
||||
download_type* download() { return &m_download; }
|
||||
const download_type* c_download() const { return &m_download; }
|
||||
|
||||
torrent::FileList* file_list() { return m_download.file_list(); }
|
||||
const torrent::FileList* c_file_list() const { return m_download.file_list(); }
|
||||
|
||||
torrent::Object* bencode() { return m_download.bencode(); }
|
||||
file_list_type* file_list() { return &m_fileList; }
|
||||
tracker_list_type* tracker_list() { return &m_trackerList; }
|
||||
|
||||
const std::string& message() const { return m_message; }
|
||||
@@ -137,7 +137,6 @@ private:
|
||||
|
||||
// Store the FileList instance so we can use slots etc on it.
|
||||
download_type m_download;
|
||||
file_list_type m_fileList;
|
||||
tracker_list_type m_trackerList;
|
||||
|
||||
bool m_hashFailed;
|
||||
|
||||
Reference in New Issue
Block a user