1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-30 22:20:59 +01:00

Move isUri() and resolveUri() out of filetransfer.cc

These are purely related to NIX_PATH / -I command line parsing, so put
them in libexpr.
This commit is contained in:
Eelco Dolstra 2022-09-12 15:37:09 +02:00
parent 85c1959240
commit 432a3a18d2
7 changed files with 27 additions and 31 deletions

View file

@ -776,17 +776,17 @@ SourcePath EvalState::findFile(SearchPath & searchPath, const std::string_view p
}
std::optional<SourcePath> EvalState::resolveSearchPathElem(const SearchPathElem & elem, bool initAccessControl)
std::optional<SourcePath> EvalState::resolveSearchPathElem(const SearchPathElem & elem, bool initAccessControl)
{
auto i = searchPathResolved.find(elem.second);
if (i != searchPathResolved.end()) return i->second;
std::optional<SourcePath> res;
if (isUri(elem.second)) {
if (EvalSettings::isPseudoUrl(elem.second)) {
try {
auto storePath = fetchers::downloadTarball(
store, resolveUri(elem.second), "source", false).first;
store, EvalSettings::resolvePseudoUrl(elem.second), "source", false).first;
auto accessor = makeStorePathAccessor(store, storePath);
registerAccessor(accessor);
res.emplace(SourcePath {accessor, CanonPath::root});