Parcourir la source

--dir and --out option is now available in aria2.changeOption.

--dir and --out option is now available in aria2.changeOption if a
download is waiting/paused in queue.
Tatsuhiro Tsujikawa il y a 14 ans
Parent
commit
701a2d6ff8
2 fichiers modifiés avec 11 ajouts et 0 suppressions
  1. 2 0
      src/OptionHandlerFactory.cc
  2. 9 0
      src/RpcMethodImpl.cc

+ 2 - 0
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);
   }
   {

+ 9 - 0
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));