builtins.fetch{url,tarball}: Allow name attribute
This commit is contained in:
parent
eff80419c7
commit
d52d391164
3 changed files with 13 additions and 9 deletions
|
|
@ -243,13 +243,14 @@ ref<Downloader> makeDownloader()
|
|||
return make_ref<CurlDownloader>();
|
||||
}
|
||||
|
||||
Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpack, const Hash & expectedHash)
|
||||
Path Downloader::downloadCached(ref<Store> store, const string & url_, bool unpack, string name, const Hash & expectedHash)
|
||||
{
|
||||
auto url = resolveUri(url_);
|
||||
|
||||
string name;
|
||||
auto p = url.rfind('/');
|
||||
if (p != string::npos) name = string(url, p + 1);
|
||||
if (name == "") {
|
||||
auto p = url.rfind('/');
|
||||
if (p != string::npos) name = string(url, p + 1);
|
||||
}
|
||||
|
||||
Path expectedStorePath;
|
||||
if (expectedHash) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ struct Downloader
|
|||
{
|
||||
virtual DownloadResult download(string url, const DownloadOptions & options) = 0;
|
||||
|
||||
Path downloadCached(ref<Store> store, const string & url, bool unpack,
|
||||
Path downloadCached(ref<Store> store, const string & url, bool unpack, string name = "",
|
||||
const Hash & expectedHash = Hash());
|
||||
|
||||
enum Error { NotFound, Forbidden, Misc, Transient };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue