diff options
| author | Nils Maier <maierman@web.de> | 2016-08-29 16:20:56 +0200 |
|---|---|---|
| committer | Nils Maier <maierman@web.de> | 2016-08-30 14:23:42 +0200 |
| commit | 414dd14decff7429ce94f18721f4c1afe607b6ea (patch) | |
| tree | ced57819e83081222769422e5408b8575300c2ed /src | |
| parent | 852e2db5860c2cb8f653cb69763ee08c0e70d94c (diff) | |
Add --save-not-found option
Diffstat (limited to 'src')
| -rw-r--r-- | src/OptionHandlerFactory.cc | 11 | ||||
| -rw-r--r-- | src/SessionSerializer.cc | 4 | ||||
| -rw-r--r-- | src/prefs.cc | 2 | ||||
| -rw-r--r-- | src/prefs.h | 2 | ||||
| -rw-r--r-- | src/usage_text.h | 5 |
5 files changed, 24 insertions, 0 deletions
diff --git a/src/OptionHandlerFactory.cc b/src/OptionHandlerFactory.cc index 001fa77f..725329db 100644 --- a/src/OptionHandlerFactory.cc +++ b/src/OptionHandlerFactory.cc @@ -344,6 +344,17 @@ std::vector<OptionHandler*> OptionHandlerFactory::createOptionHandlers() handlers.push_back(op); } { + OptionHandler* op(new BooleanOptionHandler( + PREF_SAVE_NOT_FOUND, TEXT_SAVE_NOT_FOUND, A2_V_TRUE, + OptionHandler::OPT_ARG)); + op->addTag(TAG_ADVANCED); + op->setInitialOption(true); + op->setChangeOption(true); + op->setChangeGlobalOption(true); + op->setChangeOptionForReserved(true); + handlers.push_back(op); + } + { OptionHandler* op( new BooleanOptionHandler(PREF_FORCE_SEQUENTIAL, TEXT_FORCE_SEQUENTIAL, A2_V_FALSE, OptionHandler::OPT_ARG, 'Z')); diff --git a/src/SessionSerializer.cc b/src/SessionSerializer.cc index 20317bf8..88290658 100644 --- a/src/SessionSerializer.cc +++ b/src/SessionSerializer.cc @@ -286,6 +286,10 @@ bool SessionSerializer::save(IOFile& fp) const case error_code::IN_PROGRESS: save = saveInProgress_; break; + case error_code::RESOURCE_NOT_FOUND: + case error_code::MAX_FILE_NOT_FOUND: + save = saveError_ && dr->option->getAsBool(PREF_SAVE_NOT_FOUND); + break; default: save = saveError_; break; diff --git a/src/prefs.cc b/src/prefs.cc index eb1a1079..8ec80569 100644 --- a/src/prefs.cc +++ b/src/prefs.cc @@ -349,6 +349,8 @@ PrefPtr PREF_STOP_WITH_PROCESS = makePref("stop-with-process"); PrefPtr PREF_ENABLE_MMAP = makePref("enable-mmap"); // value: true | false PrefPtr PREF_FORCE_SAVE = makePref("force-save"); +// value: true | false +PrefPtr PREF_SAVE_NOT_FOUND = makePref("save-not-found"); // value: 1*digit PrefPtr PREF_DISK_CACHE = makePref("disk-cache"); // value: string diff --git a/src/prefs.h b/src/prefs.h index 9188f656..cc759f28 100644 --- a/src/prefs.h +++ b/src/prefs.h @@ -302,6 +302,8 @@ extern PrefPtr PREF_STOP_WITH_PROCESS; extern PrefPtr PREF_ENABLE_MMAP; // value: true | false extern PrefPtr PREF_FORCE_SAVE; +// value: true | false +extern PrefPtr PREF_SAVE_NOT_FOUND; // value: 1*digit extern PrefPtr PREF_DISK_CACHE; // value: string diff --git a/src/usage_text.h b/src/usage_text.h index ef3b1732..5484f6e8 100644 --- a/src/usage_text.h +++ b/src/usage_text.h @@ -971,6 +971,11 @@ " situations. This may be useful to save\n" \ " BitTorrent seeding which is recognized as\n" \ " completed state.") +#define TEXT_SAVE_NOT_FOUND \ + _(" --save-not-found[=true|false] Save download with --save-session option even\n" \ + " if the file was not found on the server. This\n" \ + " option also saves control file in that\n" \ + " situations.") #define TEXT_DISK_CACHE \ _(" --disk-cache=SIZE Enable disk cache. If SIZE is 0, the disk cache\n" \ " is disabled. This feature caches the downloaded\n" \ |
