mirror of
https://github.com/NixOS/nix
synced 2025-07-03 18:41:47 +02:00
Fix findFile(), coerceToPath()
This commit is contained in:
parent
e7f8aa8bdd
commit
b4c6adfd35
13 changed files with 92 additions and 80 deletions
|
@ -89,17 +89,18 @@ Bindings * MixEvalArgs::getAutoArgs(EvalState & state)
|
|||
return res.finish();
|
||||
}
|
||||
|
||||
Path lookupFileArg(EvalState & state, std::string_view s)
|
||||
SourcePath lookupFileArg(EvalState & state, std::string_view s)
|
||||
{
|
||||
if (isUri(s)) {
|
||||
return state.store->toRealPath(
|
||||
fetchers::downloadTarball(
|
||||
state.store, resolveUri(s), "source", false).first.storePath);
|
||||
auto storePath = fetchers::downloadTarball(
|
||||
state.store, resolveUri(s), "source", false).first.storePath;
|
||||
auto & accessor = state.registerAccessor(makeFSInputAccessor(state.store->toRealPath(storePath)));
|
||||
return {accessor, "/"};
|
||||
} 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
|
||||
return absPath(std::string(s));
|
||||
return state.rootPath(absPath(std::string(s)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue