novoda / download-manager

A library that handles long-running downloads, handling the network interactions and retrying downloads automatically after failures
Apache License 2.0
483 stars 63 forks source link

Delete empty folders #514

Closed logicalusman closed 5 years ago

logicalusman commented 5 years ago

Problem

When deleting a download batch, all of the files get deleted but leaving the folders.

Solution

The solution is to let the DownloadBatch delete folders after deleting files - this requires DownloadBatch to know the storage root of the batch. Helper and internal classes to Batch , such as, LiteBatchFileBuilder knew the formation of batch storage path. That knowledge is now extracted to BatchStorageRoot so it is now used by the DownloadBatch to delete the batch folders.