Always save control file if --force-save is given

This commit is contained in:
Tatsuhiro Tsujikawa 2013-07-28 18:07:29 +09:00
parent 41121e09f7
commit de55569de5
3 changed files with 12 additions and 9 deletions

View File

@ -1144,8 +1144,9 @@ Advanced Options
.. option:: --force-save[=true|false]
Save download with :option:`--save-session <--save-session>` option
even if the download is completed or removed. This may be useful to
save BitTorrent seeding which is recognized as completed state.
even if the download is completed or removed. This option also saves
control file in that situations. This may be useful to save
BitTorrent seeding which is recognized as completed state.
Default: ``false``
.. option:: --gid=<GID>

View File

@ -334,7 +334,8 @@ public:
!group->getDownloadContext()->isChecksumVerificationNeeded()) {
group->applyLastModifiedTimeToLocalFiles();
group->reportDownloadFinished();
if(group->allDownloadFinished()) {
if(group->allDownloadFinished() &&
!group->getOption()->getAsBool(PREF_FORCE_SAVE)) {
group->removeControlFile();
saveSignature(group);
} else {
@ -517,11 +518,10 @@ void RequestGroupMan::fillRequestGroupFromReserver(DownloadEngine* e)
void RequestGroupMan::save()
{
for(RequestGroupList::iterator itr = requestGroups_.begin(),
eoi = requestGroups_.end(); itr != eoi; ++itr) {
const std::shared_ptr<RequestGroup>& rg = *itr;
for(auto& rg : requestGroups_) {
if(rg->allDownloadFinished() &&
!rg->getDownloadContext()->isChecksumVerificationNeeded()) {
!rg->getDownloadContext()->isChecksumVerificationNeeded() &&
!rg->getOption()->getAsBool(PREF_FORCE_SAVE)) {
rg->removeControlFile();
} else {
try {

View File

@ -921,8 +921,10 @@
#define TEXT_FORCE_SAVE \
_(" --force-save[=true|false] Save download with --save-session option even\n" \
" if the download is completed or removed. This\n" \
" may be useful to save BitTorrent seeding which\n" \
" is recognized as completed state.")
" option also saves control file in that\n" \
" situations. This may be useful to save\n" \
" BitTorrent seeding which is recognized as\n" \
" completed state.")
#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" \