diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 4630f97c..a2e02b45 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -1883,6 +1883,7 @@ OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_BITTORRENT); op->setInitialOption(true); op->setCumulative(true); + op->setChangeOptionForReserved(true); handlers.push_back(op); } { diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc index 9218a6cd..9b86ef49 100644 --- a/src/RpcMethodImpl.cc +++ b/src/RpcMethodImpl.cc @@ -36,6 +36,7 @@ #include #include +#include #include "Logger.h" #include "LogFactory.h" @@ -1156,6 +1157,19 @@ void changeOption group->getOption()->get(PREF_OUT))); } } + if(option.defined(PREF_DIR) || option.defined(PREF_INDEX_OUT)) { + if(dctx->hasAttribute(bittorrent::BITTORRENT)) { + std::istringstream indexOutIn(group->getOption()->get(PREF_INDEX_OUT)); + std::vector > indexPaths = + util::createIndexPaths(indexOutIn); + for(std::vector >::const_iterator i = + indexPaths.begin(), eoi = indexPaths.end(); i != eoi; ++i) { + dctx->setFilePathWithIndex + ((*i).first, + util::applyDir(group->getOption()->get(PREF_DIR), (*i).second)); + } + } + } if(option.defined(PREF_MAX_DOWNLOAD_LIMIT)) { group->setMaxDownloadSpeedLimit (option.getAsInt(PREF_MAX_DOWNLOAD_LIMIT));