1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 14:51:16 +02:00

Refactor downloadCached() interface

(cherry picked from commit df3f5a78d5)
This commit is contained in:
Eelco Dolstra 2019-05-22 23:36:29 +02:00
parent 7b9c68766d
commit f8b30338ac
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
6 changed files with 63 additions and 49 deletions

View file

@ -45,9 +45,11 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
Path lookupFileArg(EvalState & state, string s)
{
if (isUri(s))
return getDownloader()->downloadCached(state.store, s, true).path;
else if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') {
if (isUri(s)) {
CachedDownloadRequest request(s);
request.unpack = true;
return getDownloader()->downloadCached(state.store, request).path;
} else if (s.size() > 2 && s.at(0) == '<' && s.at(s.size() - 1) == '>') {
Path p = s.substr(1, s.size() - 2);
return state.findFile(p);
} else