mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 06:22:42 +01:00
builtins.fetch{url,tarball}: Allow name attribute
(cherry picked from commit d52d391164)
This commit is contained in:
parent
66151dc154
commit
7bb4d028a8
3 changed files with 12 additions and 8 deletions
|
|
@ -188,7 +188,7 @@ DownloadResult downloadFile(string url, const DownloadOptions & options)
|
|||
}
|
||||
|
||||
|
||||
Path downloadFileCached(const string & url, bool unpack)
|
||||
Path downloadFileCached(const string & url, bool unpack, string name)
|
||||
{
|
||||
Path cacheDir = getEnv("XDG_CACHE_HOME", getEnv("HOME", "") + "/.cache") + "/nix/tarballs";
|
||||
createDirs(cacheDir);
|
||||
|
|
@ -223,9 +223,10 @@ Path downloadFileCached(const string & url, bool unpack)
|
|||
storePath = "";
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
if (!skip) {
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ struct DownloadResult
|
|||
|
||||
DownloadResult downloadFile(string url, const DownloadOptions & options);
|
||||
|
||||
Path downloadFileCached(const string & url, bool unpack);
|
||||
Path downloadFileCached(const string & url, bool unpack, string name = "");
|
||||
|
||||
MakeError(DownloadError, Error)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue