diff --git a/doc/rtorrent.1.xml b/doc/rtorrent.1.xml index f987a17b..0e4c2401 100644 --- a/doc/rtorrent.1.xml +++ b/doc/rtorrent.1.xml @@ -751,6 +751,42 @@ Change the key-bindings. + + FILE-SYSTEM SETTINGS + + File-system related settings. + + + + + + max_file_size = size + +Set the maximum size a file can have. Disable by +passing -1. + + + + + split_file_size = size + +Split files in a torrent larger than size into +seperate files. Disable by passing -1. + + + + + split_suffix = string + +Set the suffix used on split files. Defaults +to .part. + + + + + + + ADVANCED SETTINGS diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index 0c6076d9..6c9b2a13 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -45,6 +45,7 @@ #include #include #include +#include #include "utils/variable_generic.h" @@ -193,11 +194,14 @@ DownloadFactory::receive_success() { if (control->variable()->get_value("max_file_size") > 0) download->variable()->set("max_file_size", control->variable()->get("max_file_size")); -// if (control->variable()->get_value("split_file_size") >= 0) -// download->variable()->set("split_file_size", control->variable()->get("split_file_size")); - -// if (!control->variable()->get_string("split_suffix").empty()) -// download->variable()->set("split_suffix", control->variable()->get("split_suffix")); + // Check first if we already have these values set in the session + // torrent, so that it is safe to change the values. + // + // Need to also catch the exceptions. + if (control->variable()->get_value("split_file_size") >= 0) + torrent::file_split_all(download->download()->file_list(), + control->variable()->get_value("split_file_size"), + control->variable()->get_string("split_suffix")); if (!rtorrent->has_key_string("directory")) download->variable()->set("directory", m_variables.get("directory")); diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc index 6d64de41..0efbe370 100644 --- a/src/option_handler_rules.cc +++ b/src/option_handler_rules.cc @@ -521,7 +521,7 @@ initialize_option_handler(Control* c) { variables->insert("max_file_size", new utils::VariableValue(-1)); variables->insert("split_file_size", new utils::VariableValue(-1)); - variables->insert("split_suffix", new utils::VariableAny("")); + variables->insert("split_suffix", new utils::VariableAny(".part")); variables->insert("port_range", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_port_range, c)));