diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 875174bd..4630f97c 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -213,6 +213,7 @@ OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_FILE); op->setInitialOption(true); op->setChangeGlobalOption(true); + op->setChangeOptionForReserved(true); handlers.push_back(op); } { @@ -848,6 +849,7 @@ OptionHandlerFactory::createOptionHandlers() op->addTag(TAG_HTTP); op->addTag(TAG_FILE); op->setInitialOption(true); + op->setChangeOptionForReserved(true); handlers.push_back(op); } { diff --git a/src/RpcMethodImpl.cc b/src/RpcMethodImpl.cc index c2036426..9218a6cd 100644 --- a/src/RpcMethodImpl.cc +++ b/src/RpcMethodImpl.cc @@ -1147,6 +1147,15 @@ void changeOption (*i)->setMaxConnectionPerServer(maxConn); } } + if(option.defined(PREF_DIR) || option.defined(PREF_OUT)) { + if(dctx->getFileEntries().size() == 1 && + !dctx->hasAttribute(bittorrent::BITTORRENT)) { + dctx->getFirstFileEntry()->setPath + (group->getOption()->blank(PREF_OUT) ? A2STR::NIL : + util::applyDir(group->getOption()->get(PREF_DIR), + group->getOption()->get(PREF_OUT))); + } + } if(option.defined(PREF_MAX_DOWNLOAD_LIMIT)) { group->setMaxDownloadSpeedLimit (option.getAsInt(PREF_MAX_DOWNLOAD_LIMIT));