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

Add support for root base directory #475

Closed pablisco closed 5 years ago

pablisco commented 5 years ago

Problem

When providing "/" as the path to use with saveTo() we end up with a final location that contains /// on it.

Solution

Use Optional to make sure we fall back to absent when providing a null or root path (using filterNot).

Then, when we compile the final path, we map to path + '/' or an empty string if absent.

Rational for other changes